KingPowers's blog

By KingPowers, history, 15 months ago, In English

https://mirror.codeforces.com/contest/666/submission/299989066

https://mirror.codeforces.com/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!

  • Vote: I like it
  • +64
  • Vote: I do not like it

| Write comment?
»
15 months ago, hide # |
 
Vote: I like it -53 Vote: I do not like it
#define For(i, a, b) for(int i = (a); i <= (b); i++)
#define Rof(i, a, b) for(int i = (a); i >= (b); i--)

😳

»
15 months ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

judger fluctuation

»
15 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

It is because you used different GNUs. It happens, but I don't know why it happens.

»
15 months ago, hide # |
Rev. 2  
Vote: I like it +17 Vote: I do not like it

I'm sure that the e array forms a death vector causing the cin to be abnormally slow, there is no UB involved. i created a test myself and found that it took 7000ms just to read in all the input.

code i used for check
»
15 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

peltorator come you like this shit

»
15 months ago, hide # |
Rev. 2  
Vote: I like it -10 Vote: I do not like it

Newer versions of everything provide improvements and bug fixes!