#P9998. [Ynoi2000] rfrqwq
[Ynoi2000] rfrqwq
Problem Description
Given a sequence of length , each position contains an integer in .
Define as the number of integers such that and .
There are operations:
1 l r x: Set all elements in the interval to .
2 l r x: Query, within the interval , the sum of over all pairs such that .
Input Format
The first line contains two integers .
The second line contains integers separated by spaces, representing the sequence .
Then follow lines, each containing four integers separated by spaces, representing an operation.
Output Format
For each operation of type , output one line containing one integer, the answer.
10 10
2 1 2 1 8 3 2 1 2 2
2 6 9 2
2 3 10 2
2 2 10 2
2 1 3 2
2 4 10 1
1 2 4 2
2 3 10 2
2 2 7 1
2 2 7 2
2 3 6 2
2
20
20
2
4
30
0
9
0
Hint
Idea: nzhtl1477, Solution: nzhtl1477, Code: ccz181078, Data: ccz181078.
For of the testdata, .
For another of the testdata, there are no type operations.
For another of the testdata, the operation types are in , and are generated uniformly at random in . The two endpoints of the interval are integers generated uniformly at random from . If after generation, swap them.
For another of the testdata, .
For of the testdata, , , , and all inputs are integers.
Translated by ChatGPT 5