Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Why is this submission so slow? D2. DFS Checker (Hard Version)

Revision en1, by neal, 2024-08-11 22:52:24

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English neal 2024-08-11 22:52:24 345 Initial revision (published)