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

6029번 - Chocolate Eating 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB129201821.176%

문제

Bessie has received N (1 <= N <= 50,000) chocolates from the bulls, but doesn't want to eat them too quickly, so she wants to plan out her chocolate eating schedule for the next D (1 <= D <= 50,000) days in order to maximize her minimum happiness level over the set of those days.

Bessie's happiness level is an integer that starts at 0 and halves (rounding down if necessary) over night as she sleeps. However, when she eats chocolate i, her happiness level increases by integer H_i (1 <= H_i <= 1,000,000). If she eats chocolates on a day, her happiness for that day is considered the happiness level after she eats the chocolates. Bessie insists that she eat the chocolates in the order that she received them.

If more than one optimal solution exists, print any one of them.

Consider a sequence of 5 chocolates to be eaten over a period of 5 days; they respectively bring happiness (10, 40, 13, 22, 7).

If Bessie eats the first chocolate (10 happiness) on the first day and then waits to eat the others, her happiness level is 10 after the first day.

Here is the complete schedule which turns out to maximize her minimum happiness:

 Day Wakeup happiness Happiness from eating Bedtime happiness
 1 0 10+40 50
 2 25 --- 25
 3 12 13 25
 4 12 22 34 
 5 17 7 24

The minimum bedtime happiness is 24, which turns out to be the best Bessie can do.

입력

  • Line 1: Two space separated integers: N and D
  • Lines 2..N+1: Line i+1 contains a single integer: H_i

출력

  • Line 1: A single integer, the highest Bessie's minimum happiness can be over the next D days
  • Lines 2..N+1: Line i+1 contains an integer that is the day on which Bessie eats chocolate i

제한

예제 입력 1

5 5
10
40
13
22
7

예제 출력 1

24
1
1
3
4
5

힌트

출처

Olympiad > USA Computing Olympiad > 2009-2010 Season > USACO February 2010 Contest > Silver 3번

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

출처

대학교 대회

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

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