KingPowers's blog

By KingPowers, history, 25 hours ago, In English

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!

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

»
25 hours ago, # |
  Vote: I like it -43 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--)

😳

»
19 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I think this might be related to the static initialization sequencing problem that peltorator faced recently.

But that involved template programming, so I'm not sure what causes this.

»
18 hours ago, # |
  Vote: I like it -8 Vote: I do not like it

judger fluctuation

»
18 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
14 hours ago, # |
Rev. 2   Vote: I like it +12 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
  • »
    »
    10 hours ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    Thank you very much! I'm sure that this is the real reason.

»
14 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

peltorator come you like this shit