CF864E Fire
题目描述
某人的房子着火了,他想从大火中带走价值总和尽量多的物品,每次他只能带走一个,分别给出挽救某物品需要的时间 $t$,该物品开始燃烧的时间 $d$(从 $d$ 时间开始就不能再挽救该物品了),该物品的价值 $p$。
输入格式
无
输出格式
无
说明/提示
In the first example Polycarp will have time to save any two items, but in order to maximize the total value of the saved items, he must save the second and the third item. For example, he can firstly save the third item in $ 3 $ seconds, and then save the second item in another $ 2 $ seconds. Thus, the total value of the saved items will be $ 6+5=11 $ .
In the second example Polycarp can save only the first item, since even if he immediately starts saving the second item, he can save it in $ 3 $ seconds, but this item will already be completely burned by this time.