TLE in PRETNUM

It Is a very strange error. I have given max test cases each worst possible getting a runtime of 0.37 on ideone. The time limit is (1-2) still getting tle.One of the accepted solutions was run by me on the same test cases and my code was abt 2x faster for a test case(extreme). In the mail received from codechef my codes’ run time was given as 1.20 and status tle. The problem clearly specifies 1-2 sec.
What could be the problem? Please help me out if anybody knows the cause.I will provide the links of the codes if i get response.

Check your code for
1
999999000000 1000000000000

the approach you are using is taking time and that is causing you a TLE.
Solutions are available now try something else that runs faster.
If you want you can use this property— http://stackoverflow.com/questions/19732748/finding-number-of-numbers-which-have-prime-number-of-factors

view my solution — http://www.codechef.com/viewsolution/2978321

http://discuss.codechef.com/questions/28909/pretnum-editorial

5 Likes

Thanx laxman94 for answering. I ran my solution for the test code for your test case. Ran in 0.07 sec. even when 5 cases are given like this, it took 0.36 seconds.I have got tles before but this one baffles me.

Your code btw took 0.12 sec on ideone for the same case.
http://ideone.com/js1rMM <— Your code
http://ideone.com/p5tDP5<— my code
The answer might be different. but why the tle.

If it isn,t giving the right answer then why are you trying to optimize it. First correct the solution then think of correcting it first…

2 Likes

And you are talking about your code hmm…
look at this when i tried fifty test cases -> http://ideone.com/oGqrOA <-my code was able to do in 2.74 sec.

and your code couldn’t even do it in 5 seconds, then i raised it to 15s it was able to do it in 5.34 seconds.-> http://ideone.com/A4BRfV

And the input file these guyz are using is not something with 4-5 test cases.

About my code it took only 0.43 sec during the contest. Comparing with such a solution after checking for 2-3 inputs may sound insane according to me.

2 Likes

I thought when they specify the no of test cases, they are ->not<- being funny there. For test cases upto limit of five my code was feasible so i did that. Thanx a lot bro nyws!