#P2623. 物品选取
物品选取
Description
Xiao X can choose from items, divided into three categories: A, B, and C.
-
Type A items have values that change with the volume you allocate to them. Their value follows the function , where and are two parameters for each type A item. Note: for type A items, there is only one item for each volume amount.
-
Type B items have fixed value and volume , and each has a parameter , which is the number of copies available.
-
Type C items also have fixed value and volume , but the number of copies available is unlimited.
Your task is to determine the maximum total value Xiao X can carry in his backpack.
Input Format
The first line contains two integers and , the number of items and the backpack capacity.
Then follow lines, each describing one item. The first integer indicates the item category:
- If , it is a type A item. The next two integers , are this item's two parameters.
- If , it is a type B item. The next three integers , , denote the item's value, its volume, and the number of copies available, respectively.
- If , it is a type C item. The next two integers , denote the item's value and its volume.
Output Format
Output a single line containing one integer: the maximum total value that can be carried in the backpack.
1 0
1 1 1
0
4 10
2 1 2 1
1 1 2
3 5 2
2 200 2 3
610
Hint
- For of the testdata, only types B and C appear.
- For of the testdata, , , .
- For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号