#P6587. 超超的序列 加强
超超的序列 加强
Description
Given a sequence , and two types of operations:
1 x y v: add to all where .2 x y: query the sum of all where .
This problem is strictly online.
Input Format
The first line contains two integers .
The second line contains integers; the -th one is .
Then follow several lines, each containing several integers:
When , the last three integers of are, in order, for this operation;
When , the last two integers of are, in order, for this operation.
It is guaranteed that there are no extra integers in the input.
For each operation, .
Here denotes the answer output by the previous query; if there has been no query before, then .
Output Format
Output the result of each query.
5 3
1 2 3 4 6
1 2 1
1 1 1 3
2 0 0
7
25
Hint
Sample Explanation
For Sample 1:
- For the first operation, , the contributing indices are , so the answer is .
- For the second operation, , the indices that need to add are , so add to .
- For the third operation, , the contributing indices are , so the answer is .
Constraints
- For of the testdata, .
- For of the testdata, there is a newline after each operation.
- For of the testdata, , .
- For operations 1 and 2, and .
Translated by ChatGPT 5
京公网安备 11011102002149号