Loading repovive.com/problems/classics/53
Given an array, process point-add updates and range-sum queries.
5 5 1 2 3 4 5 2 1 3 1 2 10 2 1 3 1 5 -5 2 4 5
The three printed sums are 6, then 16 after adding to position 2, then 4 after subtracting from position 5.
6 16 4
1 4 0 2 1 1 1 1 5 1 1 -2 2 1 1
The only position starts at 0, then becomes 3, so the printed values are 0 and 3.
0 3
4 3 -1 2 -3 4 2 2 4 1 3 10 2 1 4
The first query totals 3; after adding 10 to position 3, the whole array totals 12.
3 12