#P5524. [Ynoi2012] NOIP2015 充满了希望
[Ynoi2012] NOIP2015 充满了希望
Problem Description
You are given a sequence of length and operations, numbered from to . Each operation is one of the following:
1 x y: Swap the two elements at positions and in the sequence.
2 l r x: Set all elements in the interval of the sequence to .
3 x: Query the value at position in the sequence.
Now there are queries. Each query gives an operation interval :
First set all elements in the sequence to , then perform all operations from to in order. Find the sum of the answers of all type operations among these operations.
Queries are independent.
Input Format
The first line contains three integers .
Then follow lines. Each line contains to integers, describing an operation.
Then follow lines. Each line contains two integers , meaning that the operations in are executed in order, and you need the sum of the answers of all type operations.
Output Format
For each query, output one integer per line representing the answer.
5 10 6
3 1
3 5
2 5 5 10
3 1
2 5 5 5
3 5
3 1
1 1 5
2 5 5 3
3 5
5 6
3 6
1 10
2 8
3 10
7 8
5
5
8
5
8
0
Hint
Idea: nzhtl1477 & ccz181078, Solution: nzhtl1477 & ccz181078, Code: ccz181078, Data: ccz181078.
Constraints:
For of the testdata, .
For of the testdata, .
For another of the testdata, there is no type operation.
For another of the testdata, there is no type operation.
For of the testdata, , .
Translated by ChatGPT 5