#P3161. [CQOI2012] 模拟工厂
[CQOI2012] 模拟工厂
Description
There is a game called “Simulated Factory” as follows: at time , the factory’s productivity equals . At each time, you may either increase productivity or produce goods. If you choose to increase productivity, then at the next time the factory’s productivity increases by ; if you choose to produce goods, then at the next time your number of goods increases by , where is the factory’s productivity at the current time.
There are orders, and you may choose to accept or reject each one. The -th order requires delivering goods to the buyer at time . After completion, your goods decrease by , and your revenue increases by yuan. If you accept order , you must transact exactly at time , neither earlier nor later. Multiple orders may be accepted at the same time, but each order can be accepted at most once. Maximize the final total revenue.
For example, if there are two orders and , the following strategy is optimal: at times , , increase productivity (so the productivity at time is ), then at times and produce goods; at time you will have goods. Accept order at this time (you will still have goods left), and continue producing goods at times and ; then at time you will have goods, exactly meeting order .
Input Format
The first line contains an integer , the number of orders. Each of the following lines contains three integers .
Output Format
Output a single line with the maximum total revenue. The answer is guaranteed to fit in the 32-bit signed integer range.
2
5 1 8
7 15 3
11
Hint
Constraints
| Index | ||||
|---|---|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号