#P7709. 「Wdsr-2.7」八云蓝自动机 Ⅱ
「Wdsr-2.7」八云蓝自动机 Ⅱ
Description
The Yakumo Ran Automaton maintains a sequence of length , where each element has an initial value. The automaton supports the following three operations:
-
: Set all numbers in the range to , i.e., .
-
: Swap the values of and .
-
: Query the value of .
To test the efficiency of the Yakumo Ran Automaton, Yukari needs to run a huge number of tests. To generate all operations for each test, Yukari constructed an operation sequence of length , where each element of is an operation that the Yakumo Ran Automaton can execute.
Let denote the sum of the results of all type operations after starting from the initial state and executing operations in order. In particular, if there is no type operation among them, then .
Yukari will ask the Yakumo Ran Automaton queries. Each query gives a triple , and the automaton needs to compute
$$\left(\sum_{i=l}^r \Upsilon(i,p)\right) \mod 2^{32}$$Input Format
-
The first line contains two integers , with meanings as described above.
-
The second line contains integers, the initial values of sequence .
-
The next lines describe the operation sequence . For each operation, the first integer is , indicating the operation type.
-
If , then three integers follow, describing a type operation.
-
If , then two integers follow, describing a type operation.
-
If , then one integer follows, describing a type operation.
-
-
The next line contains an integer , the total number of queries initiated by Yakumo Yukari.
-
The next lines each contain three integers , describing a query, with the execution as stated above.
Output Format
- Output lines. Each line contains one integer, the answer to the corresponding query.
10 10
12 11 6 6 1 18 9 1 13 20
2 1 8
1 7 7 12
2 4 10
2 5 10
2 9 5
3 7
1 4 8 7
1 1 9 13
3 5
3 6
10
1 4 10
3 3 3
2 2 7
1 4 6
2 2 9
1 8 8
2 6 8
2 6 8
2 5 6
1 4 9
146
0
12
42
25
60
48
48
39
94
Hint
-
This problem has one and only one . In this , the first few testdata satisfy , which can be used to check the correctness of your algorithm.
-
For of the testdata, it holds that:
-
.
-
$1 \le a_i,k \le 10^9;1 \le op \le 3;1 \le x,y \le n;x \neq y$.
-
For all operations, ; for all queries, .
-
Translated by ChatGPT 5
京公网安备 11011102002149号