Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
ADAUNIQ - Ada and Unique Vegetable |
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?
Input
The first line contains 1 ≤ N, Q ≤ 2×105 , length of furrow and number of queries.
Next line contains N integers 0 ≤ Ai ≤ 2×105, the kind of ith vegetable
Each of following Q lines contains one of the following kinds of query:
1 I V: The vegetable on index 0 ≤ I < N, will be changed to kind 0 ≤ A ≤ 2×105
2 L R: 0 ≤ L ≤ R < N , the index of left/right bound of segment for which you want to know the number of unique kinds.
Output
For each query of second kind, print the number of unique kinds of vegetable.
Example Input
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
Example Output
1 2 0 3 4 2
Adicionado por: | Morass |
Data: | 2017-02-23 |
Tempo limite: | 8s |
Tamanho do fonte: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL |