P13983 Sequence Blocking Primer 8
Background
The constraint ranges of the test data of the Luogu Sequence Blocking Primer series differ from those of the original problems.
Description
Given a sequence of length $n$ and $n$ operations, where the operations involve querying how many elements in an interval are equal to a number $c$, and then changing all elements in this interval to $c$.
Input Format
The first line contains a number $n$.
The second line contains $n$ numbers separated by spaces, where the $i$-th number is $a_i$.
Then $n$ queries follow, each on one line with three numbers $l$, $r$ and $c$ separated by spaces.
It means first querying how many numbers in $[l,r]$ are equal to $c$, and then changing all numbers in $[l,r]$ to $c$.
Output Format
For each query, output one line with a single number, the answer.
Explanation/Hint
## Subtasks
Subtask 1 ($40$ points): $1 \leq n \leq 100000$, $-2^{31} \leq a_i, c\leq 2^{31}-1$.
Subtask 2 ($60$ points): $1 \leq n \leq 300000$, $-2^{31} \leq a_i, c\leq 2^{31}-1$.
For all test data, $1 \leq n \leq 300000$, $-2^{31} \leq a_i, c\leq 2^{31}-1$ and $1 \leq l \leq r \leq n$.
Translated by QwenWork