Given a sequence, two operations are provided:
1. query the numbers in the [L, R] interval.
2. Single-point Modification
N, m <= 1 W
Decision tree? Chair tree? No! This question is only violent for 2 S. Don't think it's complicated! Please try it out!
Discretization of numbers! The tag is replaced by a timestamp! 675b second cut! Not so cool!
... Well, if you think this is meaningless, you can try a tree-type set of bitsets, which should be faster.
In short, the holiday progress is 50%: 66.7% million dead-end
# Include <cstdio> # include <cstring> # include <iostream> # include <algorithm> # define M 10010 using namespace STD; int n, m, a [m], map [1001001], TOT; int f [M + 1000], T, ans; int main () {int I, j, X, Y; char P [10]; cin> N> m; for (I = 1; I <= N; I ++) {scanf ("% d", & X); If (! Map [x]) map [x] = ++ tot; A [I] = map [X];} for (I = 1; I <= m; I ++) {scanf ("% S % d", P, & X, & Y); If (P [0] = 'R') {If (! Map [y]) map [y] = ++ tot; A [x] = map [y];} else {ans = 0; ++ T; for (j = x; j <= y; j ++) if (F [A [J]! = T) ++ ans, F [A [J] = T; printf ("% d \ n", ANS );}}}
Bzoj hundreds of thousands of colors violent