Select for us
All submissions for this problem are available.You are a hiring manager in MegaHard and You have been given a task to shortlist candidates. You have decided to shortlist at least $K$ candidates out of $N$ candidates. You want everyone to have an equal chance and if any two candidates have solved the same number of problems you have decided to call both of them :). Given a list $S$ of the number of solved problems by candidates calculate the minimum number of candidates whom you must shortlisted. ###Input: - First-line will contain $N$, $K$ number of candidates and the minimum number of candidates to shortlist. - The second line contains $N$ space-separated integers $S1$ ,$S2$ ,…,$SN$. ###Output: output in a single line minimum number of candidates you must shortlist to follow the condition stated above. ###Constraints - $1 \leq N \leq 10000$ - $1 \leq K \leq N$ - $1 \leq S[i] \leq 100$ ###Sample Input 1: 5 2 5 3 2 1 4 ###Sample Output 1: 2 ###Sample Input 2: 3 1 2 2 2 ###Sample Output 2: 3 Prepared by : [Shahraaz](https://www.codechef.com/users/shahraaz)
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.