#ABC144E. Gluttony
Gluttony
题目描述
Takahashi will take part in an eating contest. Teams of members will compete in this contest, and Takahashi's team consists of players numbered through from youngest to oldest. The consumption coefficient of Member is .
In the contest, foods numbered through will be presented, and the difficulty of Food is . The details of the contest are as follows:
- A team should assign one member to each food, and should not assign the same member to multiple foods.
- It will take seconds for a member to finish the food, where is the consumption coefficient of the member and is the difficulty of the dish.
- The score of a team is the longest time it takes for an individual member to finish the food.
Before the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by , as long as it does not go below . However, for financial reasons, the members can do at most sets of training in total.
What is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?
高桥将参加一次进食比赛。由 名队员组成的队伍将参加比赛,高桥的队伍由 名队员组成,从最小到最大的队员编号为 到 。成员 的消费系数为 。
在比赛中,将展示编号为 至 的 种食物,食物 的_难度_为 。比赛详情如下:
- 每队应为每种食物指派一名成员,不得为多种食物指派同一成员。
- 一名成员完成食物需要 秒,其中 为该成员的消耗系数, 为菜肴的难度。
- 一个团队的得分就是单个成员完成食物所需的最长时间。
比赛前,高桥团队决定进行一些训练。在一组训练中,只要不低于 ,成员就可以将自己的消耗系数降低 。然而,出于经济原因, 名成员总共最多只能进行 组训练。
通过选择成员的训练量和优化菜肴分配,该小组可能获得的最低分数是多少?
输入格式
输入内容按以下格式标准输入:
输出格式
打印该队的最低得分。
样例 #1
样例输入 #1
3 5
4 2 1
2 3 1
样例输出 #1
2
样例 #2
样例输入 #2
3 8
4 2 1
2 3 1
样例输出 #2
0
样例 #3
样例输入 #3
11 14
3 1 4 1 5 9 2 6 5 3 5
8 9 7 9 3 2 3 8 4 6 2
样例输出 #3
12
说明
数据规模与约定
- 输入值均为整数
样例 解释
他们可以获得 的分数,如下所示:
- 成员 在 秒内完成 组训练并吃掉食物 。
- 成员 进行 组训练,在 秒内吃完食物 。
- 成员 在 秒内完成 组训练并吃掉食物 。
他们的得分不可能低于 ,所以答案是 。
样例 解释
他们可以选择不进行 组训练。