#P13983. 数列分块入门 8
数列分块入门 8
Background
The constraint ranges of the test data of the Luogu Sequence Blocking Primer series differ from those of the original problems.
Problem Description
Given a sequence of length and operations, where the operations involve querying how many elements in an interval are equal to a number , and then changing all elements in this interval to .
Input Format
The first line contains a number .
The second line contains numbers separated by spaces, where the -th number is .
Then queries follow, each on one line with three numbers , and separated by spaces.
It means first querying how many numbers in are equal to , and then changing all numbers in to .
Output Format
For each query, output one line with a single number, the answer.
4
1 2 2 4
1 3 1
1 4 4
1 2 2
1 4 2
1
1
0
2
Hint
Subtasks
Subtask 1 ( points): , .
Subtask 2 ( points): , .
For all test data, , and .
Translated by QwenWork