Hello everyone,
I was trying this problem : Click
I couldn't get any idea. So, read the editorial.
It mentioned to square root decompose the queries and then solve the problem. I don't really get the idea behind it.
can someone, please explain?
P.S.: I know about SQRT decomposition
The idea is to process the queries in blocks of queries.
Here's the code, perhaps it will make things clearer: Xenia and Tree