atcoder#ABC174F. [ABC174F] Range Set Query
[ABC174F] Range Set Query
Score : points
Problem Statement
We have colored balls arranged in a row from left to right; the color of the -th ball from the left is .
You are given queries. The -th query is as follows: how many different colors do the -th through -th balls from the left have?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the response to the -th query.
4 3
1 2 1 3
1 3
2 4
3 3
2
3
1
- The -st, -nd, and -rd balls from the left have the colors , , and - two different colors.
- The -st, -rd, and -th balls from the left have the colors , , and - three different colors.
- The -rd ball from the left has the color - just one color.
10 10
2 5 6 5 2 1 7 9 7 2
5 5
2 4
6 7
2 2
7 8
7 9
1 8
6 9
8 10
6 8
1
2
2
1
2
2
6
3
3
3