Doubt regarding WA


Why is there a time difference between WA and TLE Solutions ?

Lets suppose that I submit the wrong code for some problem. I might have put ‘-’ in place of ‘+’ somewhere, and get WA with runtime, say, x sec.

Once I correct my mistake, I get TLE with runtime, say, y > x. Why does this happen ?

Mate, As far as i know (not sure how codechef servers work), when u solve a problem, submit a solution. At whatever instant your solution gives error (say throws IndexOutOfBounds Exception), It terminate at that very instant without further running at that test file and give RE.

In case your solution gives WA, your solution didn’t give error or threw exception, but your answer was not correct, You’ll get a WA. In this case, time should be nearly equal to correct answer if your solution is wrong because of just a wrong sign. (assuming sign change doesn’t affect runtime of your specific program greatly, like terminating a loop before required or something similar).

Hope that clarifies…

1 Like

Better share solution if it’s not for a ongoing contest.

it’s from an ongoing contest, I’ll share after the contest is over

Alright… :slight_smile: