动物AI (CI翻译)
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 是一位因职业成就而闻名的杰出人物(正如你必须记得的那样,他在一家储存 Ogudar-Olok 的仓库工作——这是一种神奇但不含酒精的饮料)。辛苦工作了一天后,他回到了家。那天,他不得不喝掉 9875 箱这种饮料,回家后便立刻上床睡觉。AI (CI翻译)
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 梦见自己经营着一个成功的农场。他梦见每天都有一只动物来到他面前,请求他允许自己在那里定居。然而,DravDe 极其善良,他也可以将动物拒之门外,而动物会被拒绝离开。DravDe 的梦境恰好持续 $*n*$ 天。第 $*i*$ 天到来的动物每天需要吃掉 $*c*_{*i*}$ 吨食物,从第 $*i*$ 天开始计算。但如果某一天动物无法得到它所需的食物,它就会非常难过。梦境开始时,农场中恰好有 $*X*$ 吨食物。AI (CI翻译)
DravDe woke up terrified...
DravDe 惊恐地醒来了……AI (CI翻译)
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.
当他向你复述这个梦时,他已经记不清在第 $*n*$ 天结束时农场里有多少只动物了,但他记得没有任何动物感到难过(因为那是一个幸福的农场),并且动物数量尽可能多。这就是他希望你求出的数量。AI (CI翻译)
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 只在下午开始喂养它们。因此,如果一只想要加入农场的动物被拒绝,它就不会吃掉农场中的任何食物。但如果动物加入了农场,它从到达当天起一直到第 $*n*$ 天每天都会进食。AI (CI翻译)
Input
输入格式
AI (CI翻译)The first input line contains integers $*n*$ and $*X*$ ($1 ≤ *n* ≤ 100, 1 ≤ *X* ≤ 10^{4}$) — 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 ≤ 10^{4}$)——DravDe 梦境的天数,以及农场最初拥有的食物总量(单位:吨)。第二行包含整数 $c{i}$($1 ≤ c{i} ≤ 300$)。第二行中的数字以空格分隔。AI (CI翻译)
Output
输出格式
AI (CI翻译)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*$ 天结束时农场中最多可能拥有的动物数量。AI (CI翻译)
Note
说明
AI (CI翻译)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 (CI翻译)
样例
3 4
1 1 1
2
3 6
1 1 1
3
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。