Problem 8: Chocolate Eating [Brian Hamrick, 2010]
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.
PROBLEM NAME: ceating
INPUT FORMAT:
* Line 1: Two space separated integers: N and D
* Lines 2..N+1: Line i+1 contains a single integer: H_i
SAMPLE INPUT (file ceating.in):
5 5
10
40
13
22
7
OUTPUT FORMAT:
* 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
SAMPLE OUTPUT (file ceating.out):
24
1
1
3
4
5
问题8:巧克力吃[布莱恩哈姆里克,2010]
Bessie has received N (1 <= N <= 50,000) chocolates from the bulls,贝西已收到ñ(1 <= N的<= 50000)巧克力从公牛队,
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)她的下一个D巧克力(1 <= D的<吃时间表= 50000)
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贝西的幸福水平是一个整数,在0和半开始
(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). 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考虑5巧克力序列食用,5期
days; they respectively bring happiness (10, 40, 13, 22, 7).天,他们分别带来快乐(10,40,13,22,7)。
If Bessie eats the first chocolate (10 happiness) on the first day如果贝西吃了第一家巧克力(10快乐)的第一天
and then waits to eat the others, her happiness level is 10 after然后等待其他人吃,她的幸福水平是10后
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 1 0 10 40 50
- 2 25 --- 25 2 25 --- 25
- 3 12 13 25 3 12 13 25
- 4 12 22 34 4 12 22 34
- 5 17 7 24 5 17 7 24
复制代码The minimum bedtime happiness is 24, which turns out to be the best复制代码最低睡前幸福是24,这原来是最好的
Bessie can do.贝西可以做。
PROBLEM NAME: ceating问题的名称:ceating
INPUT FORMAT:输入格式:
* Line 1: Two space separated integers: N and D *第1行:两个空间分隔整数:n和d
* Lines 2..N+1: Line i+1 contains a single integer: H_i *线路2 .. N +1个:行我一包含一个整数:H_i
SAMPLE INPUT (file ceating.in):示例输入(文件ceating.in):
5 5 5 5
10 10
40 40
13 13
22 22
7 7
OUTPUT FORMAT:输出格式:
* Line 1: A single integer, the highest Bessie's minimum happiness can *第1行:一个整数,最高贝西的最低快乐,
be over the next D days在未来D天
* Lines 2..N+1: Line i+1 contains an integer that is the day on which *线路2 .. N +1个:行我一包含一个整数,是这一天,
Bessie eats chocolate i贝西我吃巧克力
SAMPLE OUTPUT (file ceating.out):示例输出(文件ceating.out):
24 24
1一
1一
3 3
4 4
5 5
google翻译的~~哈哈
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息