QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 256 MB Total points: 100

#12748. Buffcraft

Statistics

Brenda 喜欢一款新的角色扮演游戏《Buffcraft》。在《Buffcraft》中,盾牌、剑、书和其他随身物品不会影响角色的属性。提升角色属性的唯一方法是使用增益(buff)。

《Buffcraft》中有两种类型的增益。直接增益(direct buffs)增加属性的基础值,而百分比增益(percentage buffs)按基础值的比例增加属性。具体来说,如果角色的初始基础属性值为 $b$,你使用了 $n$ 个强度分别为 $d_1, d_2, \dots, d_n$ 的直接增益,以及 $m$ 个强度分别为 $p_1, p_2, \dots, p_m$ 的百分比增益,那么最终的属性值将等于 $(b + d_1 + d_2 + \dots + d_n)(100 + p_1 + p_2 + \dots + p_m)/100$。注意,最终的属性值可能是小数。

不幸的是,你的角色只有 $k$ 个增益槽位。如果你对她施加超过 $k$ 个增益,只有最后施加的 $k$ 个增益会保持有效。因此,同时施加超过 $k$ 个增益是没有意义的。你不能重复使用同一个增益。

Brenda 准备派她的角色去参加副本,并希望将她的生命值提升到尽可能高的水平。她手头有一些直接增益和百分比增益,需要你的帮助来选择一组增益,以使总生命值达到最大。

输入格式

输入文件的第一行包含四个整数 $b, k, c_d$ 和 $c_p$ —— 角色的基础生命值、增益槽位数量、可用的直接增益数量以及可用的百分比增益数量。

接下来一行包含 $c_d$ 个整数 $d_i$ —— 直接增益的强度。

最后一行包含 $c_p$ 个整数 $p_i$ —— 百分比增益的强度。

输入文件中的所有数字均大于或等于零,且小于或等于五万。

输出格式

输出文件的第一行必须包含两个整数 $n$ 和 $m$ —— 要使用的直接增益和百分比增益的数量($0 \le n \le c_d; 0 \le m \le c_p; 0 \le n + m \le k$)。

接下来一行必须包含 $n$ 个不同的数字 —— 要施加的直接增益的索引(增益从 1 开始编号)。

最后一行必须包含 $m$ 个不同的数字 —— 要施加的百分比增益的索引(同样从 1 开始编号)。

应用所有 $n + m$ 个增益后的最终总生命值必须尽可能大。

样例

样例输入 1

70 3 2 2
40 30
50 40

样例输出 1

2 1
2 1
1

样例输入 2

1 2 3 4
6 6 5
8 10 7 9

样例输出 2

2 0
1 2

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.