If you know Square Root Decomposition algorithm, then this problem will be a piece of cake for you. Just save the summation for each block.

Update: update the value of the index and update the summation of the corresponding block.

If you can do the update part, I believe solving the query part won't be any problem for you.

Statistics

73% Solution Ratio
mh755628Earliest, Feb '21
Ahasan_1999Fastest, 0.2s
moursalinmeLightest, 9.4 MB
MursaleenShortest, 921B
Toph uses cookies. By continuing you agree to our Cookie Policy.