#1573. BIT I: Single Modify, Interval Query
BIT I: Single Modify, Interval Query
Description
Given a sequence , There're operations you need do execute, divided into two types:
1 i x
: Given , add to ;2 l r
: Given , print out (i.e. ).
Input
The first line contains 2 integers — the sequence length and the number of queries. .
The second line contains integers — the initial sequence. .
Each of the next lines contains an operation, 1 i x
or 2 l r
.
。
Output
Each line prints the sum for an operation 2.
Sample
3 2
1 2 3
1 2 0
2 1 3
6
Limits And Hints
All cases satisfiy , .