What's the fastest DS?

Revision en1, by i_love_sqrt_decomp, 2025-08-08 04:59:20

I have a problem that reduces to doing 2 kinds of queries:

  • Add a number in $$${1,-1}$$$ to a range.
  • Query the number of 0s in a suffix. It's guranteed that the array is nonnegative.

Constraints: $$$n\leq 10^5, Q\leq 192\cdot10^5$$$. My best solution did this problem in about 3.5 seconds using sqrt decomposition.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English i_love_sqrt_decomp 2025-08-08 04:59:20 340 Initial revision (published)