#P7557. [USACO21OPEN] Acowdemia S
[USACO21OPEN] Acowdemia S
Description
Because of her love for computer science, and the temptation of someday becoming “Dr. Bessie,” the cow Bessie has started pursuing a PhD in computer science. After some time doing research, she has published papers (), and her -th paper has received citations from other research works ().
Bessie has heard that academic achievement can be measured using the -index. The -index is the largest integer such that the researcher has at least papers with at least citations each. For example, if a researcher has papers with citation counts , then the -index is . However, if the citation counts are , then the -index would be .
To increase her -index, Bessie plans to write at most survey papers (), and in each survey she will cite many of her previous papers. However, due to page limits, she can cite at most papers in a single survey (). Of course, within one survey she can cite any given paper at most once (but a paper can be cited in multiple surveys).
Please help Bessie find the maximum -index she can achieve after writing these surveys. Bessie cannot cite her other surveys within a survey.
Note that Bessie’s advisor may warn her that writing surveys purely to increase the -index may be considered academically unethical; we do not recommend other researchers imitate Bessie’s behavior.
Input Format
The first line contains , , and .
The second line contains space-separated integers .
Output Format
Output the maximum -index that can be achieved.
4 4 1
1 100 1 1
3
4 1 4
1 100 1 1
2
Hint
Sample Explanation
For the first sample, Bessie can write at most four surveys, and each survey can cite at most one paper. If Bessie cites her first and third papers two times each, her -index becomes .
For the second sample, Bessie can write at most one survey. If Bessie cites any one of her first, third, or fourth papers, her -index becomes .
Test Point Properties:
- Test points satisfy .
- Test points have no additional constraints.
Notes
Problem by: Dhruv Rohatgi
Translated by ChatGPT 5
京公网安备 11011102002149号