subtask 1 : AC with 0.1 subtask two all TLE with 5.0100. What should i understand by this?

While attempting a question if i get AC in all tasks(#) of subtask 1 with 0.1 as highest execution time and get TLE in all tasks(#) of subtask 2 with 5.0100 as execution time does this mean that my code didn’t even complete for inputs of subtask 2? if not then what should i understand by this?

Any help would clear this fundamental doubt :slight_smile:

1 Like

It means that your code is taking a lot of time for subtask-2. Basically, It means that your code TLE’D for the constraints of Subtask-2

No… it does not means that your code didn’t gave correct output as needed if you are getting TLE. It might be possible your code is giving correct output what is required.
BUT, it is taking longer time than what is required, i.e. program was compiled successfully, but it took longer time. So, you must try optimizing your approach for solving.

There’s a maximum time allowed for programs to complete, given in the problem and scaled for different languages. One second is typical but other values are possible. You’re using Python - that gets a time multiplier of 5 because it’s an interpreted language.

If your code runs without finishing and without error to the maximum time limit, it is stopped and that task gets TLE, Time Limit Exceeded. (So technically, yes, your code didn’t complete). For a problem with subtasks, you can get partial points if your program runs to accurate completion for all cases of a subtask, and that seems to be your case. On the submissions table, this shows up as “AC” with a number of marks less than the full number possible. On the actual result screen and elsewhere it should show up as “partially correct” (for example with a yellow check rather than a green one).

As in every problem on codechef there is a time limit mentioned.when your execution time just crosses the time limit then it stop executing your code and gives a error i.e. TLE.

By TLE it doesn’t mean that your answer is wrong.your answer may be correct . Online judge doesn’t check that after crossing time limit.

To overcome TLE you have to optimize your approach and write a better algorithm for that problem.

some tips are:-

(1)
Avoid nested loop as much as u can

(2)Check your method of input

(3) Avoid sorting of large array

(4)try to write modified inbuit function for your problem so as to reduce execution time

happy coding;

TLE usually means that the approach is flawed, as in there is a better algorithm available to complete the task. Problem setters establish a time limit somewhere between the optimal algorithm run time and the next best algorithm run time. This serves to weed out submissions which do not use that optimal algorithm. For example, if the optimal algorithm for a problem runs with O(log(N)), the time limit will be set so that a O(N) algorithm will hit the time limit.

It is possible that the algorithm used is correct, but the actual implementation uses excessive resources. For me, my implementations are usually decent, so when I get TLE I begin looking for alternatives to the chosen algorithm.

//