#P7707. 「Wdsr-2.7」百花齐放的太阳花田
「Wdsr-2.7」百花齐放的太阳花田
Description
At the beginning, Yuuka chooses flowers in the sunflower field. Each flower has a height and a type . They are arranged in a line and numbered . Yuuka has operations of two kinds:
-
: Consider all flowers in the interval . Take out all flowers whose height is not greater than (that is, flowers with ), and arrange them in order (that is, do not change their relative order in the original sequence). Then, according to their types, they can be divided into several consecutive segments (for example, $\{\underline{1,}\ \underline{2,2},\underline{1,1},\underline {3,}\ \underline{4,4,4}\}$ can be divided into segments). Yuuka wants you to tell her how many segments there are in total.
-
: Yuuka selects one flower with height and type , and appends it to the end.
Forced online.
Input Format
-
The first line contains three integers . The meanings of are as above, and is the forced online parameter.
-
The next two lines: the first line contains integers, representing ; the third line contains integers, representing the sequence . Their meanings are as described above.
-
Then follow lines. Each line begins with an integer , indicating the type of this operation.
-
If , then three integers follow, describing one query.
-
If , then two integers follow, describing one modification.
-
-
In all operations, the real are obtained by XOR-ing the input values with . Here, is the answer of the last query, initially .
Output Format
- There are several lines. For each operation , output one integer per line, which is the answer.
10 10 0
6 8 5 9 6 10 2 4 8 9
2 4 3 3 4 1 2 3 3 2
2 2 8
1 1 4 4
2 1 6
2 10 2
1 7 9 7
2 10 8
2 8 4
2 3 10
1 5 16 5
1 4 14 7
0
2
5
5
10 20 0
2 19 13 20 7 19 17 8 15 12
1 2 4 3 5 3 2 4 2 2
2 9 3
2 17 3
1 1 9 15
1 1 12 3
2 15 5
1 6 13 6
2 7 1
2 20 3
2 12 1
2 10 1
1 5 9 4
1 1 7 15
2 12 4
1 12 12 14
2 7 5
1 3 18 6
1 7 7 1
2 8 5
1 6 8 10
1 14 18 4
5
1
0
0
3
0
0
0
1
0
Hint
denotes the length of the sequence after all operations.
$$\def\arraystretch{1.5} \begin{array}{|c|c|c|c|}\hline \bf{Subtask} & \bm{n',m} & \textsf{\textbf{Special Property}} & \textsf{\textbf{Score}} \cr\hline 1 & 1\le n',m \le 10^3 & \text{None} & 10 \cr\hline 2 & 1\le n',m \le 3\times 10^5 & k=0 & 20\cr\hline 3 & 1\le n',m \le 3\times 10^5 & l=1 & 25\cr\hline 4 & 1\le n',m \le 10^5 & \text{None} & 15\cr\hline 5 & 1\le n',m \le 3\times 10^5 & \text{None} & 20\cr\hline 6 & \text{No special constraints} & \text{Time limit 3s, memory limit 300MB} & 10\cr\hline \end{array}$$-
For of the testdata:
。
,。
,。
Hint: please pay attention to constant optimization.
Translated by ChatGPT 5
京公网安备 11011102002149号