At Techfest International Coding Challenge, there are n participants sitting from m different countries of the world in a single line on their computers. The administrator is given the power to choose atmost k participants and eliminate them out of the line.
After the eliminations, the remaining participants come closer to fill up the gaps created by the administrator. The skill of the administrator is decided on the points he scores by carrying out this elimination, which is calculated as follows:
The score is the maximum number of participants of a single country sitting together consecutively in the line after the closing of the gaps post elimination. Remember, the administrator may eliminate no more than k participants. It is allowed not to eliminate anyone at all.
The input consists of three space separated integers n, m, k. In the next line there are n integers from 1 to m - the number of participant country. The numbers alloted to countries are separated by single space.
Print the maximum score
1 ≤ n ≤ 2·105
1 ≤ m ≤ 105
0 ≤ k < n
Input: 10 2 2 1 2 1 2 1 1 2 1 1 2 Output: 5
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions