Verdict changes by addition or removal of a single comment

Hi!

I was trying the question https://www.codechef.com/problems/TREDIFF/

In two particular submissions, I am getting different verdicts (TLE and AC) only by adding or removing a line.
The astonishment is that the line is a comment !!

DETAILS -

  1. SUBMISSION
    https://www.codechef.com/viewsolution/33537618
    Line 105 has the comment
    //go home u drunk
    Verdict - TLE

  2. SUBMISSION
    https://www.codechef.com/viewsolution/33537626
    Line 105 has nothing
    Verdict - AC

Can anyone explain this strange behavior? I am not able to get this through my head. Maybe I am making some silly mistakes and not able to see them? Any help would be appreciated.

P.S. - I used https://www.diffchecker.com/ to find the differences in the two codes. You might find it useful.

1 Like

Your accepted code runs in 1.9 out of 2 seconds, what you’re seeing is just judge variation and has nothing to do with the comment.

1 Like

okay… What does judge variation mean? Does having more lines in the code make it run slower?

It has nothing to do with lines. A bunch of factors go into how long your program takes, usually based on the computer that’s running it, and they can be different each time, causing different execution times.

To enhance my point, you could submit the exact same code twice and get two different verdicts.

2 Likes

But one code is taking 0.05 seconds and other 1.9 seconds How its possible?

It’s only 0.05 seconds because it doesn’t count the testcase that caused a TLE verdict

Yeah but variation is of 0.01 second hardly.

Clearly it’s more than that

The first one is AC because it got the first subtask, look at the points

Oh my bad i am sorry

I got it

I tried submitting same code 4 times more, still TLE. I’ll try again after 12 hours to give a chance to servers to cool down :slight_smile: . I still think there is something else at play here :man_shrugging:

without the comment

Also, notice the variance between the commented submissions in the runtime of the first subtask

1 Like

Yes, your last two submissions have exactly same code still different running times. Now I understand judge can give 0.1-0.2s difference in running times occasionally.
Thank You !

1 Like