atcoder#ABC273C. [ABC273C] (K+1)-th Largest Number
[ABC273C] (K+1)-th Largest Number
Score : points
Problem Statement
You are given a sequence of length . For each , solve the following problem.
Find the number of integers between and (inclusive) such that:
- contains exactly distinct integers greater than .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. For , the -th line should contain the answer for .
6
2 7 1 8 2 8
2
1
2
1
0
0
For example, we will find the answer for .
- Regarding , contains distinct integers greater than : and .
- Regarding , contains distinct integer greater than : .
- Regarding , contains distinct integers greater than : , and .
- Regarding , contains distinct integers greater than (there is no such integer).
- Regarding , contains distinct integers greater than : and .
- Regarding , contains distinct integers greater than (there is no such integer).
Thus, there are two 's, and , such that contains exactly distinct integers greater than . Therefore, the answer for is .
1
1
1
10
979861204 57882493 979861204 447672230 644706927 710511029 763027379 710511029 447672230 136397527
2
1
2
1
2
1
1
0
0
0