#P8987. [北大集训 2021] 简单数据结构
[北大集训 2021] 简单数据结构
Background
CTT2021 D2T1
Problem Description
Xiao D is a master of data structures. He especially likes studying data structures with simple forms. Today he came up with the following problem.
You have a sequence of length . You need to perform modifications or queries:
- Given , change every to .
- Change every to .
- Given , query .
As a top-level data structure master, Xiao D solved this problem easily. Now he wants to test you, who are about to take part in IOI2022. He believes you can also solve it easily.
Input Format
The first line contains two positive integers , representing the length of the sequence and the number of modifications/queries.
The next line contains integers , representing the initial sequence .
The next lines each start with a positive integer , indicating the type of the -th modification/query.
- If , it is followed by an integer , meaning perform modification 1 once.
- If , it means perform modification 2 once.
- If , it is followed by two positive integers , meaning perform query 3 once.
Output Format
Output several lines, each containing one integer as an answer.
15 15
6 14 14 6 3 6 4 13 10 3 12 5 11 9 6
1 9
1 2
2
2
2
1 11
3 4 6
2
1 6
2
1 9
1 11
1 11
3 4 4
3 2 13
33
9
107
Hint
| Subtask ID | Subtask Score | Special Property | |
|---|---|---|---|
| A | |||
Constraints: , .
Property A: are generated uniformly at random in , is generated uniformly at random in , and is generated uniformly at random among all valid intervals.
Translated by ChatGPT 5