#P1964. 【mc生存】卖东西
【mc生存】卖东西
Description
lcy0x1 goes to the server’s system shop to sell items.
A player’s backpack has slots.
Initially, his backpack contains different item types (cannot be sold), which occupy slots.
He wants to sell types of items. For the -th type with name , there are items, each worth , and up to items can be stacked in one slot.
Identical items can be put in the same slot as long as it is not full.
Question: In one run, what is the maximum amount of money he can sell?
Input Format
The first line contains two integers .
Each of the next lines contains three integers and a string .
Output Format
The maximum amount of money .
20 3
63 1 64 yinshifen
1 10 1 men
1 1 64 yinshifen
64
Hint
Constraints:
- ;
- ;
- ;
- ;
- ;
- ;
- 。
Note: The testdata is strong. Brute-force search scores . Please use the bounded knapsack.
Translated by ChatGPT 5
京公网安备 11011102002149号