ADAUNIQ - Ada and Unique Vegetable
题意翻译
* 你需要维护一个长度为 $n$ 的序列,支持两种操作。
* 第一种操作为 ``1 x y``,代表将第 $x$ 个数修改为 $y$。
* 第二种操作为 ``2 l r``,需要你求出在第 $l$ 到 $r$ 个数中恰好出现了一次的数的数量。
* $n,a_i\leq2\times 10^5$
题目描述
Ada the Ladybug is cultivating vegetables. She has a long furrow full of different kinds of it and she wants to know the number of unique vegetables on a segment of the furrow. As the cultivation is a dynamic process, a kind (on a single position) might become another kind during this process.
Given furrow and a few updates, can you answer questions asking about number of unique kinds of vegetable on a segment?
输入输出格式
输入格式
The first line contains **1 , length of furrow and number of queries.**
Next line contains **N** integers **0 , the kind of **i $ ^{th} $** vegetable**
Each of following **Q** lines contains one of the following kinds of query:
_1 I V_: The vegetable on index **0 , will be changed to kind 0**
_2 L R_: **0 , the index of left/right bound of segment for which you want to know the number of unique kinds.**
输出格式
For each query of second kind, print the number of unique kinds of vegetable.
温馨提示:下标从 $0$ 开始。
输入输出样例
输入样例 #1
8 8
1 2 3 3 1 2 3 3
2 1 3
2 0 3
2 0 7
1 3 4
1 7 0
2 1 3
2 0 3
2 0 7
输出样例 #1
1
2
0
3
4
2