11 1 s 128 MB
The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination.
The successful applicants of the examination are chosen as follows.
Let's see the first couple of examples given in Sample Input below. In the first example, n_{min} and n_{max} are two and four, respectively, and there are five applicants whose scores are 100, 90, 82, 70, and 65. For n of two, three and four, the gaps will be 8, 12, and 5, respectively. We must choose three as n, because it maximizes the gap.
In the second example, n_{min} and n_{max} are two and four, respectively, and there are five applicants whose scores are 100, 90, 80, 75, and 65. For n of two, three and four, the gap will be 10, 5, and 10, respectively. Both two and four maximize the gap, and we must choose the greatest number, four.
You are requested to write a program that computes the number of successful applicants that satisfies the conditions.
The input consists of multiple datasets. Each dataset is formatted as follows.
m n_{min} n_{max}
P_{1}
P_{2}
...
P_{m}
The first line of a dataset contains three integers separated by single spaces. m represents the number of applicants, n_{min} represents the minimum number of successful applicants, and n_{max} represents the maximum number of successful applicants. Each of the following m lines contains an integer P_{i}, which represents the score of each applicant. The scores are listed in descending order. These numbers satisfy 0 < n_{min} < n_{max} < m ≤ 200, 0 ≤ P_{i} ≤ 10000 (1 ≤ i ≤ m) and P_{nmin} > P_{nmax+1}. These ensure that there always exists an n satisfying the conditions.
The end of the input is represented by a line containing three zeros separated by single spaces.
For each dataset, output the number of successful applicants in a line.
Sample Input | Sample Output |
---|---|
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0 | 3 4 2 2 3 2 |