| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 16 | 14 | 9 | 81.818% |
Graphic design is Aditya's new passion. He has launched his new company, Turmeric, and his first client comes to him to design a new logo. The old logo consists of $n$ colored squares in a row. The $i$-th square is painted in a color represented by a number $s_i$ such that 1ドル \leq s_i \leq c,ドル where $c$ is the total number of colors in the logo. Now, the client is a very picky person. He will not allow Aditya to change any of the square's colors but he will give Aditya the artistic freedom to delete up to $k$ squares in the logo. Aditya thinks that the aesthetic score of a logo is equal to the maximum number of consecutive squares with the same color. Help Aditya figure out how to remove at most $k$ squares such that the aesthetic score of the new logo is maximized. Aditya may choose to not remove any squares.
The first line of input is 3ドル$ integers separated by spaces $n,ドル $c,ドル and $k$ such that 1ドル \leq n \leq 2 \cdot 10^5$ , 1ドル \leq c \leq 10^5,ドル and 1ドル \leq k < n$
The next line is $n$ integers $s_1, s_2 \ldots s_n$ separated by spaces representing the color of each square in the pattern, such that 1ドル \leq s_i \leq c$.
Output a single integer, the maximum possible aesthetic score of the new logo.
3 1 2 1 1 1
3
10 3 2 1 2 1 1 3 2 1 1 2 2
4