Hello Everyone.
I am trying to solve a problem [LQUERY][1] which requires SQRT Decomposition Implemenation.
My Approach :
I used SQRT Decomposition and divided array into blocks of multisets each block having block size of 320 (since 320*320 ~ 10^5). In each block, I am storing the arrays elements and as usual traversing the blocks and finding the required answer. For update, I am removing the element from the block in which it is present and inserting a new element.
Problem I am facing :
I am getting AC in 2 Test Cases, WA in 2 Test Cases and TLE in the rest.
[2]
Please Help me find out where am I doing mistake and correct me so that I can get AC :)
[1]: https://www.codechef.com/problems/LRQUER/
[2]: https://www.codechef.com/viewsolution/17978174