Time limit: 5s
Memory limit: 256MB
Input:
Output:
Task
You are given an array of length on which you need to perform operations. These come in two types, encoded as follows:
0 st dr x
: for ;1 st dr
: print .
Input data
On the first line, the numbers and are given. On the second line, the array (indexed from ) is given. On the next lines, there is one operation per line.
Output data
The results of the type 1
operations, each on a separate line.
Constraints and clarifications
- It is recommended to use the following line of code at the beginning of the
main
function, it will decrease the input reading time:cin.tie(0)->sync_with_stdio(0);
.
Example
stdin
3 2
1 2 3
0 1 3 1
1 1 3
stdout
3
Explanation
After the first operation, the array becomes . The sum of the indices from to is .