luogu#P7061. [NWRRC2014] Buffcraft
[NWRRC2014] Buffcraft
题目描述
Brenda enjoys a new role-playing game Buffcraft. Shields, swords, books and other carry-on items do not affects character stats in Buffcraft. The only way to increase the stats of your character is to buff her.
There are two types of buffs in Buffcraft. Direct buffs increase a base value of the stat, while percentage buffs increase stats by the fraction of the base value. To be precise, if unbuffed base value of your character stat is , you have buffed her using direct buffs of strength and percentage buffs of strength the resulting stat will be equal to $(b + d_{1} + d_{2} + · · · + d_{n})(100 + p_{1} + p_{2} + · · · + p_{m})/100$ . Note that the resulting stat may be fractional.
Unfortunately, your character has only buff slots and if you apply more than buffs on her, only the last buffs remains active. Thus, there is no reason to apply more than buffs simultaneously. You cannot apply the same buff more than once.
Brenda is going to send his character to raid and wants to buff her health to maximal possible value. She has some direct and some percentage buffs at her disposal and needs your help to select the set of buffs that leads to maximal possible total health.
输入格式
The first line of the input file contains four integers and — the base health of the character, the number of buff slots, the number of available directs buffs, and the number of available percentage buffs.
The following line contains integers — strengths of direct buffs.
The last line of the input file contains integer numbers — strengths of percentage buffs.
All numbers in the input file are greater than or equal to zero, and less than or equal to fifty thousand.
输出格式
The first line of the output file must contain two integers and — the number of direct and percentage buffs to use $(0 \le n \le c_{d}; 0 \le m \le c_{p}; 0 \le n + m \le k)$ .
The following line must contain different numbers — indices of direct buffs to apply (buffs are numbered from one).
The last line of the output must contain different numbers — indices of percentage buffs to apply (also numbered from one).
The resulting total health after application of all buffs must be maximal possible.
题目大意
题目描述
Brenda喜欢一款新的游戏Buffcraft。没有任何物品可以影响Buffcraft中的角色属性。增加你角色属性的唯一方法就是给予它buff。
Buffcraft中有两种类型的buff。
1.直接增加buff的值;
2.百分比增加buff的值;
如果你的角色buff初始值是,那么你使用个增益分别为的第一种buff和个增益分别为的第二种buff,得到的结果将等于$(b+d_{1}+d_{2}+··+d_{n})(100+p_{1}+p_{2}-··+p_{m})/100$。请注意,这个结果可能不是整数。
不幸的是,你的角色只有个buff槽,如果你在她身上应用了个以上的buff,那么只有最后的个buff有效。因此,你不能同时拥有个以上buff。当然,一个buff不能被多次使用。
Brenda将派她的角色去战斗,并希望将角色的buff值提升到最大。有一些第一种buff和一些第二种buff可供她使用。她需要你的帮助来选择一种buff的搭配方式,以获得最大可能的总buff值。
输入格式
第一行包含四个整数;分别代表角色的基础buff值、buff槽数、第一种buff的数量与第二种buff的数量。
第二行包含个整数,代表每个第一种buff的增益量。
第三行包含个整数,代表每个第二种buff的增益量。
输出格式
第一行是两个整数代表用了多少第一种buff和用了多少第二种buff。 .
第二行是个数字-要应用的每一个第一种buff的索引。
第二行是个数字-要应用的每一个第二种buff的索引。
你的方案要让所有buff应用后产生的总buff值尽可能最大。
输入输出样例
样例输入#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
说明/提示
数组的索引从1开始
时间限制:2s;空间限制:256MB。
70 3 2 2
40 30
50 40
2 1
2 1
1
1 2 3 4
6 6 5
8 10 7 9
2 0
1 2
提示
Time limit: 2 s, Memory limit: 256 MB.