TLE doubt.

Well I always thought that when i get a TLE it means my solution is correct, I just need to optimize my approach. But one of my friend created a doubt by saying that TLE doesn’t means that your solution is giving correct output.
So does that mean even if i remove TLE there is a probability of getting WA or something else.

Yes ofcourse! The judge will wait for your program to give any sort of output till the given time limit. If the time limit exceeds, then that particular run is cancelled abruptly and nothing is checked. So if you are getting TLE then your answer can be wrong also. But normally, you get TLE when you approach a problem naively. Naive approaches are correct except the fact that they are not at all optimal. (But silly mistakes can make your output WA even though it gives TLE. eg- Boundary test cases)

1 Like

clear now. Thanks

//