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

33056번 - Cowdependence 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB122774160.294%

문제

Farmer John's $N$ $(1 \leq N \leq 10^5)$ cows have been arranged into a line. The $i$th cow has label $a_i$ (1ドル \leq a_i \leq N$). A group of cows can form a friendship group if they all have the same label and each cow is within $x$ cows of all the others in the group, where $x$ is an integer in the range $[1,N]$. Every cow must be in exactly one friendship group.

For each $x$ from 1ドル$ to $N,ドル calculate the minimum number of friendship groups that could have formed.

입력

The first line consists of an integer $N$.

The next line contains $a_1 ... a_N,ドル the labels of each cow.

출력

For each $x$ from 1ドル$ to $N,ドル output the minimum number of friendship groups for that $x$ on a new line.

제한

예제 입력 1

9
1 1 1 9 2 1 2 1 1

예제 출력 1

7
5
4
4
4
4
4
3
3

힌트

Here are examples of how to assign cows to friendship groups for $x=1$ and $x=2$ in a way that minimizes the number of groups. Each letter corresponds to a different group.

Example:
 1 1 1 9 2 1 2 1 1
x = 1: A B B C D E F G G (7 groups)
x = 1: A A B C D E F G G (7 groups, alternative grouping)
x = 2: A A A B C D C E E (5 groups)
x = 2: A A A B C D C D E (5 groups, alternative grouping)

출처

Olympiad > USA Computing Olympiad > 2024-2025 Season > USACO 2024 December Contest > Gold 1번

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

출처

대학교 대회

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

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