#P1779. 魔鬼杀手
魔鬼杀手
Description
Each monster has some HP. You can cast spells to reduce a monster’s HP. Each spell has a certain damage, meaning one cast reduces the target’s HP by that amount. A monster is defeated if and only if its HP is less than or equal to . Casting a spell consumes mana. Because your mana is limited, you want to defeat all monsters using the minimum total mana. Write a program to accomplish this task.
Input Format
The input is given as follows:
is the number of monsters ().
is the HP of the -th monster ().
is the number of available spells ().
is the name of the -th spell, containing at most uppercase or lowercase letters.
is the mana cost of that spell ().
is either Single or All, meaning the spell either targets a single monster (Single) or affects all monsters simultaneously (All).
is the amount by which one cast reduces each affected target’s HP ().
All numbers are integers.
At least one spell has a nonzero value.
Output Format
Output one line containing a single integer, the minimum total mana required.
3
8000 15000 30000
3
Flare 45 Single 8000
Meteor 62 All 6000
Ultimate 80 All 9999
232
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号