HELP Needed for Problem LRQUER - (SQRT Decompositon)

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.


Please Help me find out where am I doing mistake and correct me so that I can get AC :)

Update : I got AC…
@admin, @vijju123, Can you please close this question ?