#abc273c. C - (K+1)-th Largest Number
C - (K+1)-th Largest Number
Score : points
问题描述
给定一个长度为 的序列 。对于每个 ,解决以下问题。
找出满足以下条件的整数 的个数,其中 的取值范围在 到 (包含)之间:
- 在序列 中,恰好有 个不重复的整数大于 。
以上为通义千问 qwen-max 翻译,仅供参考。
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 .
Sample Input 1
6
2 7 1 8 2 8
Sample Output 1
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 .
Sample Input 2
1
1
Sample Output 2
1
Sample Input 3
10
979861204 57882493 979861204 447672230 644706927 710511029 763027379 710511029 447672230 136397527
Sample Output 3
2
1
2
1
2
1
1
0
0
0
update @ 2024/3/10 11:29:56