Does time limit exceed means our answer was correct but time to run was more?
I am getting time limit exceed error, Time to run shown as 1.01 seconds while under the question its shown as 1-2 seconds. Can someone explain?
No. TLE does not mean your answer was correct. The judge kills the process as soon as the time taken by it exceeds maximum time limit. So, in case of maximum time limit ‘t’ along with TLE, you will get t + s as time taken by your program where s ~ 0.01 .
@miiitd7042075 Tle means for a given set of test cases you code is taking more time to execute or generate the output as decided bye the judges and also it does not means you answer was correct
It only means that your program ran for more time that it is allowed in the problem. However, it does mean that in the time limit that it ran, it didn’t give any wrong answer, else the verdict would be WA. Either way, the number of test cases that your program solved in those few minutes may vary from 0 to -1.
To put it more clearly, It Does NOT mean that your program has the right logic. All it means is that it is taking too much time.
Sometimes your answer is right for the first few test cases, but the next few test cases give you TLE, and once you get rid of TLE, you get wrong answer again, which means for some test cases, your logic is wrong.
Lol codechef needs a better parser. turns to
Didn’t knew i could use html tags in answers. Possible hack here?
the best answer given by @admin in this thread.
[http://discuss.codechef.com/questions/7585/why-do-i-get-a-time-limit-exceeded][1]
i am posting answer here.
To understand Time Limit Exceeded(TLE), understanding how the online judge works will help. The online judge allocates resources like memory and CPU for evaluating every submission. However, to ensure that your submission does not keep running for an infinite time, the online judge has to stop your submission from running after a particular time period. This time period is actually decided by the problem setter and is given as one of the inputs to the online judge. Once the submission program runs for time period the judge system issues a system kill command to the program execution and assigns TLE result to the submission.
The most common reason that you would get a TLE is because your program is too slow. If a problem tells you that N <= 100000, and your program has nested loops each which go up to N, your program will never be fast enough. Read the bounds in the input carefully before writing your program, and try to figure out which inputs will cause your program to run the slowest.
The second most common cause of TLE is that your method of reading input and writing output is too slow. In Java, do not use a Scanner; use a BufferedReader instead. In C++, do not use cin/cout - use scanf and printf instead.
In Python, you could try speeding up your solutions by adding the following two lines to the start of your file:
import psyco
psyco.full()
To see if your method of reading input is fast enough, try solving the Enormous Input Test problem. If you get time limit exceeded, try another method of reading input.
Finally, you may have tested your code on all sorts of large inputs and are sure your code will run inside the time limit. However, CodeChef’s judge may be slower than your computer. It is common for a program to take 2-3 times as long on CodeChef as it does on your computer. The time limits are all attainable(tested by our problem tester), so you will just need to come up with a way of making your algorithm
[1]: http://discuss.codechef.com/questions/7585/why-do-i-get-a-time-limit-exceeded
I don’t think program is killed too soon. I coded in Java and its about 7 times as slow as in C. They constantly gave me TLE error with running time between 7.3 to 7.5 sec, while in C it was between 1.01 to 1.05 sec.
Umm well it actually only means that your program ran for more time that it is allowed in the problem as you can see in the answer reviews. So technically in some cases your answers are right in some they are not.
Your program will not run successfully even accepting sample inputs. I think you should work on an algorithm and design it accordingly. Then implement it. assignment service