RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0633

Cowdependence

Diamond V 다이아몬드 V
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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.

Problem credits: Chongtian Ma

제약

SCORING

  • Inputs 2-3: \(N\le 5000\)
  • Inputs 4-7: \(a_i\le 10\) for all \(i\)
  • Inputs 8-11: No label appears more than \(10\) times.
  • Inputs 12-20: No additional constraints.

Problem credits: Chongtian Ma

입력 형식

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
출력
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)
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2024-2025 > December > Gold

태그

평가 및 의견

Cowdependence

개요
출제자 난이도 Diamond V 다이아몬드 V 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Cowdependence

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8