Why did the two identical codes produce different results?

Revision en1, by KingPowers, 2025-01-07 10:29:38

https://codeforces.me/contest/666/submission/299989066 https://codeforces.me/contest/666/submission/299988231

As you can see, these are two submission records. The code in both submissions is exactly the same (using Compare shows no differences, not even a single red line). The only difference is that for the first submission, the language chosen was C++20, while for the second submission, it was C++23. However, this difference caused the first submission to result in a TLE at 6000ms, while the second submission ran in just 800ms and passed successfully.

What could be causing this discrepancy? I suspect that there might be Undefined Behavior in my code, but I haven’t been able to identify the specific line causing the issue.

If you can help pinpoint the problem in my code or identify another reasonable explanation, I would greatly appreciate it!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English KingPowers 2025-01-07 10:29:56 2 Tiny change: '99989066\nhttps://' -> '99989066\n\nhttps://'
en1 English KingPowers 2025-01-07 10:29:38 927 Initial revision (published)