How do some people get AC for their C++ solution and I get TLE, even when my program runs faster?

My C++ program for the CodeChef: Practical coding for everyone ran at 1.08 seconds and got TLE.

When I looked at other people who got AC, there were a few that had execution times higher than mine (upto 2.6 seconds) but got AC. How does that work? Mind you these were C++ submissions as well, so “they submitted in a different programming language” is not valid here.

PS: Also I am wondering why does codechef not show the execution time in the “All submissions” tab for the TLE submissions? I checked the execution time in the e-mail that I received, if anybody wants to know.

What i think is the time sent in our mail is the time till which our program gave a correct solution. And as soon as they give a newer test case the program fails to give solution in the given time limit thus we get a TLE and the time mailed is the time till the successful execution. And in others case the program keeps on giving correct solution to the test cases in the stipulated time limit.

2 Likes

It works so, that let say your program is allowed to run for 1 second. When judge finds out, it is running longer it stops the program and tells you, that it was running for let say 1.08 second. Other times for example 2.6 is sum for all test cases, so for example if there are 13 test inputs and program run 0.2 second for each it sums up to 2.6, but every one was below 1 second…

1 Like