Logo
(追記) (追記ここまで)

20714번 - Colored Squares 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB1614981.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.

제한

예제 입력 1

3 1 2
1 1 1

예제 출력 1

3

예제 입력 2

10 3 2
1 2 1 1 3 2 1 1 2 2

예제 출력 2

4

힌트

출처

University > UT Invitational Programming Contest > UT Invitational Programming Contest 2020 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /