#ABC144E. Gluttony

Gluttony

题目描述

Takahashi will take part in an eating contest. Teams of NN members will compete in this contest, and Takahashi's team consists of NN players numbered 11 through NN from youngest to oldest. The consumption coefficient of Member ii is AiA_i.

In the contest, NN foods numbered 11 through NN will be presented, and the difficulty of Food ii is FiF_i. 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 x×yx \times y seconds for a member to finish the food, where xx is the consumption coefficient of the member and yy 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 11, as long as it does not go below 00. However, for financial reasons, the NN members can do at most KK 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?

高桥将参加一次进食比赛。由 NN 名队员组成的队伍将参加比赛,高桥的队伍由 NN 名队员组成,从最小到最大的队员编号为 11NN 。成员 ii 的消费系数为 AiA_i

在比赛中,将展示编号为 11NNNN 种食物,食物 ii 的_难度_为 FiF_i 。比赛详情如下:

  • 每队应为每种食物指派一名成员,不得为多种食物指派同一成员。
  • 一名成员完成食物需要 x×yx \times y 秒,其中 xx 为该成员的消耗系数, yy 为菜肴的难度。
  • 一个团队的得分就是单个成员完成食物所需的最长时间。

比赛前,高桥团队决定进行一些训练。在一组训练中,只要不低于 00 ,成员就可以将自己的消耗系数降低 11 。然而,出于经济原因, NN 名成员总共最多只能进行 KK 组训练。

通过选择成员的训练量和优化菜肴分配,该小组可能获得的最低分数是多少?

输入格式

输入内容按以下格式标准输入:

NN KK
A1A_1 A2A_2 ...... ANA_N
F1F_1 F2F_2 ...... FNF_N

输出格式

打印该队的最低得分。

样例 #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

说明

数据规模与约定

  • 输入值均为整数
  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 0K10180 \leq K \leq 10^{18}
  • 1Ai106 (1iN)1 \leq A_i \leq 10^6\ (1 \leq i \leq N)
  • 1Fi106 (1iN)1 \leq F_i \leq 10^6\ (1 \leq i \leq N)

样例 11 解释

他们可以获得 22 的分数,如下所示:

  • 成员 11(44)×3=0(4-4) \times 3 = 0 秒内完成 44 组训练并吃掉食物 22
  • 成员 22 进行 11 组训练,在 (21)×1=1(2-1) \times 1 = 1 秒内吃完食物 33
  • 成员 33(10)×2=2(1-0) \times 2 = 2 秒内完成 00 组训练并吃掉食物 11

他们的得分不可能低于 22 ,所以答案是 22

样例 22 解释

他们可以选择不进行 KK 组训练。