RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0342 파일 입출력

Convention

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

의견: 0

설명

Farmer John is hosting a new bovine grass-eating convention at his farm!

Cows from all over the world are arriving at the local airport to attend the
convention and eat grass. Specifically, there are \(N\) cows arriving at the
airport (\(1 \leq N \leq 10^5\)) and cow \(i\) arrives at time \(t_i\)
(\(0 \leq t_i \leq 10^9\)). Farmer John has arranged \(M\) (\(1 \leq M \leq 10^5\))
buses to transport the cows from the airport. Each bus can hold up to \(C\)
cows in it (\(1 \leq C \leq N\)). Farmer John is waiting with the buses at the
airport and would like to assign the arriving cows to the buses. A bus can leave
at the time when the last cow on it arrives. Farmer John wants to be a good host
and so does not want to keep the arriving cows waiting at the airport too long.
What is the smallest possible value of the maximum waiting time of any one
arriving cow if Farmer John coordinates his buses optimally? A cow’s waiting
time is the difference between her arrival time and the departure of her
assigned bus.

It is guaranteed that \(MC \geq N\).

Problem credits: Grace Cai

제약

Problem credits: Grace Cai

입력 형식

The first line contains three space separated integers \(N\), \(M\), and \(C\). The
next line contains \(N\) space separated integers representing the arrival time of
each cow.

출력 형식

Please write one line containing the optimal minimum maximum waiting time for
any one arriving cow.

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 convention.in
출력을 쓸 파일 convention.out
예제 1
입력
6 3 2
1 1 10 14 4 3
출력
4
설명

If the two cows arriving at time 1 go in one bus, cows arriving at times 3 and 4
in the second, and cows arriving at times 10 and 14 in the third, the longest
time a cow has to wait is 4 time units (the cow arriving at time 10 waits from
time 10 to time 14).

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2018-2019 > December > Silver

태그

평가 및 의견

Convention

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

Log in to rate problems.

개별 의견

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

풀이 제출

Convention

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