QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#19987. 你会拯救我们吗?

Statistics

身为英雄的你,即将与这个世界的最终首领 Irisu 战斗。作为英雄,你有三项角色“能力”:体魄 $B$、心智 $M$ 和智力 $I$。综合实力 $S$ 是这些能力的几何平均值。换言之,$S=\sqrt[3]{BMI}$。不幸的是,因为你在上一次与首领的战斗中失败了,现在你的所有能力都为零。

要打败 Irisu,你的综合实力必须满足神秘的不等式 $(S+5)(S+1)(S+4)\ge X$。这个不等式写在你上次战斗后从一个巨大番茄中找到的上古卷轴上。提升能力的唯一方法,是向黑暗炼金术师 Skyly 购买能力药水。Skyly 正在出售 $N_B+N_M+N_I$ 瓶药水。前 $N_B$ 瓶是体魄药水,接下来的 $N_M$ 瓶是心智药水,最后的 $N_I$ 瓶是智力药水。第 $i$ 瓶药水的价格为 $P_i$ 美元,可以使对应能力增加 $E_i$ 点。

为了同时拯救世界和钱包,你想求出为了打败最终首领而购买能力药水所需花费的最小总价。

输入格式

第一行包含四个整数 $X,N_B,N_M,N_I$。接下来的 $N_B+N_M+N_I$ 行中的第 $i$ 行包含两个整数 $P_i,E_i$。

  • $0\le X\le10^9$
  • $0\le N_B,N_M,N_I\le30$
  • $0\le P_i,E_i\le10^9$ 对所有 $1\le i\le N_B+N_M+N_I$。

输出格式

请输出为了打败最终首领而购买能力药水所需花费的最小总价。如果即使买下 Skyly 的所有药水,你仍然不够强大,请输出 DEAREST DROP。

样例

输入格式 1

31 4 1 5
9 2
6 5
3 5
8 9
7 9
3 2
3 8
4 6
2 6
4 3

输出格式 1

12

输入格式 2

5566 2 1 0
0 999999999
999999999 0
0 0

输出格式 2

DEAREST DROP

输入格式 3

50216 2 2 2
1 20
1 30
10 42
20 43
15 18
17 19

输出格式 3

29

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.