neal's blog

By neal, history, 4 months ago, In English

Can anyone tell me why this submission is so slow? 275858049

It's $$$\mathcal{O}(N + Q)$$$ and should be very fast, but somehow it takes 1125 ms.

Meanwhile my in-contest code that uses lots of sets and does a bunch of nonsense only takes 561 ms: 275858229

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

»
4 months ago, # |
  Vote: I like it +11 Vote: I do not like it

Seems like it has something to do with the compiler as its ~300ms on C++17.

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

I think it is something related to this blog: Slowdown bug affecting C++ (64 bit).

You can also check this weird TLE I got in Codeforces Round 899 (Div. 2).