#PU1136. USACO 2021 US Open, Silver — Problem 3. Acowdemia

    ID: 1617 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 提高 上传者: 标签>USACO赛事:open21来源:usaco.orgscoring:equal_test_cases二分答案贪心

USACO 2021 US Open, Silver — Problem 3. Acowdemia

USACO 2021 US Open, Silver — Problem 3. Acowdemia

题目描述

Bessie the cow has enrolled in a computer science PhD program, driven by her love of computer science and also the allure of one day becoming "Dr. Bessie". Having worked for some time on her academic research, she has now published NN papers (1≤N≤1051 \leq N \leq 10^5), and her ii-th paper has accumulated cic_i citations (0≤ci≤1050 \leq c_i \leq 10^5) from other papers in the research literature. Bessie has heard that an academic's success can be measured by their hh-index. The hh-index is the largest number hh such that the researcher has at least hh papers each with at least hh citations. For example, a researcher with 44 papers and respective citation counts (1,100,2,3)(1,100,2,3) has an hh-index of 22, whereas if the citation counts were (1,100,3,3)(1,100,3,3) then the hh-index would be 33. To up her hh-index, Bessie is planning to write up to KK survey articles (0≤K≤1050 \leq K \leq 10^5), each citing many of her past papers. However, due to page limits, she can only cite at most LL papers in each survey (0≤L≤1050 \leq L \leq 10^5). Of course, no paper may be cited multiple times in a single survey (but a paper may be cited in several surveys). Help Bessie determine the maximum hh-index she may achieve after writing these survey articles. Bessie is not allowed to cite a survey from one of her surveys.

输入格式

The first line contains NN, KK, and LL. The second line contains NN space-separated integers c1,…,cNc_1,\ldots, c_N.

输出格式

The maximum hh-index on a single line.

数据范围

Test cases 1-6 satisfy N≤100N\le 100. Test cases 7-16 satisfy no additional constraints. Problem credits: Dhruv Rohatgi

样例

样例 1

4 4 1
1 100 1 1
3
In this example, Bessie may write up to $4$ survey articles, each citing at most $1$ paper.
If she cites each of her first and third articles twice, then her $h$-index
becomes
$3$.

样例 2

4 1 4
1 100 1 1
2
In this second example, Bessie may write at most a single article. If Bessie cites any
of her first, third, or fourth papers at least once, her $h$-index becomes $2$.

提示

that writing a survey solely to increase one's hh index is ethically dubious; other academics are not recommended to follow Bessie's example here.