#P7554. [COCI 2020/2021 #6] Index
[COCI 2020/2021 #6] Index
Description
The "H-index" measures both the number of papers a researcher has and how many citations they received. A researcher's "H-index" is the largest integer such that they have at least papers, each cited at least times.
Mirko has published papers in total, and he has questions: if he had published only papers from the -th to the -th, what would his "H-index" be?
Input Format
The first line contains two integers .
The second line contains integers , where is the citation count of Mirko's -th paper.
The next lines each contain two integers , representing a question.
Output Format
Output lines. Each line contains one integer, the answer to the corresponding question.
7 6
3 2 3 1 1 4 7
3 4
1 7
1 6
4 5
1 2
5 7
1
3
3
1
2
2
Hint
Constraints and Notes
This problem uses bundled testdata.
| Subtask | Points | Constraints and Notes |
|---|---|---|
| No additional constraints |
For of the testdata, , , .
Explanation
The score of this problem follows the original COCI settings, with a full score of .
Translated from COCI2020-2021 CONTEST #6 T5 Index。
Translated by ChatGPT 5
京公网安备 11011102002149号