CF35D.Animals
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Once upon a time DravDe, an outstanding person famous for his professional achievements (as you must remember, he works in a warehouse storing Ogudar-Olok, a magical but non-alcoholic drink) came home after a hard day. That day he had to drink 9875 boxes of the drink and, having come home, he went to bed at once.
DravDe dreamt about managing a successful farm. He dreamt that every day one animal came to him and asked him to let it settle there. However, DravDe, being unimaginably kind, could send the animal away and it went, rejected. There were exactly n days in DravDe’s dream and the animal that came on the i-th day, ate exactly c__i tons of food daily starting from day i. But if one day the animal could not get the food it needed, it got really sad. At the very beginning of the dream there were exactly X tons of food on the farm.
DravDe woke up terrified...
When he retold the dream to you, he couldn’t remember how many animals were on the farm by the end of the n-th day any more, but he did remember that nobody got sad (as it was a happy farm) and that there was the maximum possible amount of the animals. That’s the number he wants you to find out.
It should be noticed that the animals arrived in the morning and DravDe only started to feed them in the afternoon, so that if an animal willing to join them is rejected, it can’t eat any farm food. But if the animal does join the farm, it eats daily from that day to the n-th.
从前,德雷夫德(DravDe)——一位以卓越职业成就而闻名的杰出人物(想必您还记得,他在一家仓库工作,负责储存奥古达尔-奥洛克(Ogudar-Olok),一种神奇但不含酒精的饮品)——在辛苦工作一天后回到了家。那天他不得不饮下 9875 箱这种饮品;到家后,他立刻上床睡觉。
德雷夫德梦见自己成功经营着一座农场。他梦见每天都会有一只动物来到他面前,请求留下来定居。然而,德雷夫德天性无比仁慈,他可以选择拒绝该动物,而被拒绝的动物便会黯然离去。他的梦境中恰好持续了 n 天;第 i 天到来的动物,从第 i 天起每天消耗恰好 ci 吨食物。但如果某天该动物未能获得它所需的全部食物,它就会变得极度悲伤。而在梦境一开始,农场上恰好存有 X 吨食物。
德雷夫德惊恐地醒了过来……
当他向你复述这个梦时,他已经记不清第 n 天结束时农场上究竟有多少只动物了;但他清楚地记得:没有任何一只动物感到悲伤(毕竟这是一座幸福的农场),而且农场上的动物数量达到了可能的最大值。这正是他希望你求出的数字。
需要特别注意的是:动物们总是在清晨抵达,而德雷夫德直到下午才开始喂食。因此,若某只希望加入农场的动物被拒绝,它便无法食用任何农场的食物;但若该动物获准留下,则它将从当天起,每日持续进食,直至第 n 天结束。
输入格式
The first input line contains integers n and X (1 ≤ n ≤ 100, 1 ≤ X ≤ 104) — amount of days in DravDe’s dream and the total amount of food (in tons) that was there initially. The second line contains integers c__i (1 ≤ c__i ≤ 300). Numbers in the second line are divided by a space.
第一行输入包含两个整数 n 和 X(1 ≤ n ≤ 100,1 ≤ X ≤ 104)——分别表示 DravDe 梦境中的天数以及最初所拥有的食物总量(单位:吨)。
第二行输入包含整数 ci(1 ≤ ci ≤ 300),这些数字以空格分隔。
输出格式
Output the only number — the maximum possible amount of animals on the farm by the end of the n-th day given that the food was enough for everybody.
输出唯一的一个数字——在第 n 天结束时农场上动物数量的最大可能值(假设食物足以满足所有动物的需求)。
输入输出样例
输入#1
3 4 1 1 1
输出#1
2
输入#2
3 6 1 1 1
输出#2
3
说明/提示
Note to the first example: DravDe leaves the second and the third animal on the farm. The second animal will eat one ton of food on the second day and one ton on the third day. The third animal will eat one ton of food on the third day.
第一个样例的说明:DravDe 将第二只和第三只动物留在农场。第二只动物在第二天和第三天各吃一吨食物。第三只动物在第三天吃一吨食物。
输入解题思路,AI测评打分。不知道怎么写?