Bizarre Judging Behavior ?

Revision en9, by notSpad2e, 2025-02-16 19:54:42

So I was solving problem D from the latest contest when I encounter a bizarre behavior. In this 306416672 the output to the second testcase is clearly incorrect.

The jury's answer is 0 2 4 2

My code's output is 0 2 4 4

Well, my code output the exact same thing as the jury in on my pc. Maybe an uninitialized variable?? No worries, it's the first testcase, I can just debug using the jury's output. In this 306417865 I print some additional variables to debug my code. The output is the line where there is only 1 integer, otherwise that line is a debug.

This time the answers came out to be

8 11
0 // First number
13 11
6 4
2 5
2 // Second number
27 11
4 // Third number
15 11
4 4
0 5
2 // Fourth number

It's the correct answer, but I changed nothing except the debug line. Then I removed the debug line and the answers became wrong again. At this point I don't even know what to do so I add some random cout << " "; to the code in this 306419133. And, amazingly, it worked. WHYYYYYYYYYYYYYYYYYYYY??????

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English notSpad2e 2025-02-16 19:54:42 0 (published)
en8 English notSpad2e 2025-02-16 19:54:31 0 (saved to drafts)
en7 English notSpad2e 2025-02-16 19:52:02 0 Tiny change: ' out to be (numbers in **bold**)\n\n~~~~~\' -> ' out to be\n\n~~~~~\' (published)
en6 English notSpad2e 2025-02-16 19:51:16 22 Tiny change: ' out to be (numbers in **bold**)\n\n~~~~~\' -> ' out to be\n\n~~~~~\' (saved to drafts)
en5 English notSpad2e 2025-02-16 19:47:46 0 (published)
en4 English notSpad2e 2025-02-16 19:47:14 160
en3 English notSpad2e 2025-02-16 19:43:44 24
en2 English notSpad2e 2025-02-16 19:43:08 613
en1 English notSpad2e 2025-02-16 19:31:24 469 Initial revision (saved to drafts)