If I get TLE in a solution does that mean our program produced correct outputs till time limit or it was producing wrong answers and than time limit encountered ? Which one is right ?
It’s the second case: it goes through all test cases doesn’t matter if it’s wrong or right then gives you TLE.
I solved a problem at Codehef a few days ago
- N < 10
- N < 1000
And I got AC for 2nd subtask but for the first subtask, I got WA. So, by this observation, you can see that it went to the first subtask and found the answer was wrong but then it didn’t stop. It went to the second subtask and Check whether you have that wrong or not.
if your program is giving output correctly on your ide but it is showing tle at the time of submission it means
your program take more time to execute than time it only depends algorithm what algorithm you think.Better algorithm less time to execute it
what about a particular sub-task ?
No, actually its the first case kunnu. Each test file is evaluated independently, and verdict of 1 file doesnt affect other. TLE is, if for a particular file your solution doesnt return output within time limit. Its very well possible to get TLE in first file and AC in second one.
What happens is, all files are run simultaneously. Verdict for each is taken. If all files grouped under 1 sub task give AC, you get points for it, else 0.
In a particular file, TLE means that any output (if any) got till now is correct but you ran out of time. However, you can get WA after fixing TLE if for any future input your code gives wrong output.
@vijju123 oh ok that makes sense Thanks