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

Aerodrom

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(3^{rd}\) round, December \(15^{th}\), 2012

The Croatian delegation, consisting of M people, is travelling to IOI 2013 in Australia^{1}. They are
currently waiting in a queue for che\(ck-in\) at the airport. There are N che\(ck-in\) desks open. Some
officials work more efficiently than others, so the desks operate at different speeds. At the \(k-th\) desk,
T_{k} seconds are required to finish che\(ck-in\) of a single passenger, and members of our delegation happen
to know the exact numbers.
In the beginning, all desks are ready to accept the next passenger, and the delegation members are the
only people in the queue. A person can only occupy (start che\(ck-in\) at) an available desk when all people
in front of that person in the queue have left the queue (started, not necessarily finished, che\(ck-in\))
already. At that moment, the person can immediately occupy an available desk (if there is one), but can
also choose to wait for another (faster) desk to become available. Our delegation members, being
computer science geeks, make this decision in such a way that the moment when all of them have
finished che\(ck-in\) is as soon as possible. Your task is finding that moment in time.
Let us describe the scenario from the first example below. There are two desks, with processing times
of 7 and 10 seconds, respectively. Out of the six people in the delegation, the first two immediately
occupy the two desks. At time 7, the first desk is freed, and the third person occupies it. At time 10, the
fourth person occupies the second desk. At time 14, the fifth person occupies the first desk. At time 20,
the second desk is freed again, but the sixth person decides to wait another second (time 21) for the
first desk to become available, and then occupy it. This way, the che\(ck-in\) is completed by time 28. If
the sixth person hadn't waited for the faster desk, the che\(ck-in\) would have taken a total of 30 seconds.

제약

In test data worth a total of 75 points, the number M will be at most 300 000.

^{1} Assuming, of course, that the Apocalypse didn't happen.
\(3^{rd}\) round, December \(15^{th}\), 2012

입력 형식

The first line of input contains two positive integers, N (\(1 \le N \le 100\,000\)), the number of desks, and
M (\(1 \le M \le 1\,000\,000\,000\)), the number of people in the delegation.
Each of the following N lines contains a number T_{k} from the problem statement (\(1 \le T_{k} \le 10^{9}\)).

출력 형식

The first and only line of output must contain the required minimum time in seconds.

예제 1
입력
2 6
7
10
출력
28
예제 2
입력
7 10
3
8
3
6
9
2
4
출력
8
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2012/2013 Contest 3

평가 및 의견

Aerodrom

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Aerodrom

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