#P15094. [UOI 2025 II Stage] Three Queries
[UOI 2025 II Stage] Three Queries
题目描述
Given an array of length and queries. We also have a binary array of infinite length, initially all .
There are three types of queries:
- --- toggle the value of (from to , and vice versa).
- --- count the number of unique numbers in the array in the range for which and .
- --- assign the value to .
Provide an answer for each query of the second type.
输入格式
The first line contains two integers and ~--- the length of the array and the number of queries.
The second line contains integers ~--- the values of the elements of the array.
Each of the following lines starts with an integer --- the type number of each query:
- If , the query contains one integer --- toggle the value of .
- If , the query contains two integers and --- count the number of unique numbers in the array in the range for which and .
- If , the query contains two integers and --- replace the value of with .
输出格式
For each query of the second type, output the number of unique numbers in the range on a separate line.
10 5
3 4 3 4 3 2 3 1 2 1
2 2 5
1 3
2 2 5
3 4 5
2 2 5
2
1
2
提示
In the example for the first query of the second type, the segment looks like , meaning there are numbers , , and , are equal to , so the answer is . After the next query of type , becomes , so for the next query, the answer is . After the next query, the array will look like . In the last query, the segment will look like , meaning there are numbers , respectively the answer is , because .
Scoring
- ( points): ;
- ( points): only queries of type ; ; ;
- ( points): only queries of type ;
- ( points): only queries of type and ; all are pairwise distinct;
- ( points): only queries of type and ; all can change only once;
- ( points): only queries of type and ;
- ( points): only queries of type and ;
- ( points): at any moment, ;
- ( points): ;
- ( points): without additional constraints.