#P10081. [GDKOI2024 提高组] 新本格魔法少女
[GDKOI2024 提高组] 新本格魔法少女
Problem Description
You are given an integer sequence of length .
You are given an operation sequence consisting of operations, numbered from to . The sequence contains assignment operations and range sum operations. An assignment operation gives , and sets to . A range sum operation gives , and queries .
There are queries. Each query gives , asking for the sum of answers of all range sum operations when you initialize the sequence to , then apply the -th, -th, , -th operations in order.
Input Format
The first line contains three integers .
The next lines each describe one operation in the form or .
The next lines each contain two integers , describing one query.
Output Format
Output lines. Each line contains one integer, the answer to each query in order.
10 5 4
1 9 10 7
1 7 10 9
2 3 10
1 10 10 1
2 5 10
2 5
1 1
3 4
1 3
64
0
0
36
Hint
For all testdata, , , , and .
For of the testdata, .
For another of the testdata, .
For another of the testdata, every operation is a range sum operation.
For another of the testdata, every query satisfies .
For another of the testdata, .
For the remaining testdata, there are no special constraints.
Translated by ChatGPT 5