Problem D. Shoot Game
时间限制 1000 ms
内存限制 256 MB
You are playing a shooting game. The rules of the game are like this: You are in a two-dimensional plane and stand at $(0, 0)$. There are some obstacles above the x-axis. The location of each obstacle can be expressed as a tuple $(H, L, R)$, It means there is an obstacle at the height of $H$, interval $L$ to $R$. The $i_{th}$ obstacle with $W_i$ defense power.
You can shoot out "Energy beam of life". Each time you can consume $X$ vitality then shoot out an energy beam with $X$ attack power. The energy beam is a ray, When an energy beam hit an obstacle. If it's attack power not less than defense power of obstacle, it will destroy and pass through this obstacle. Otherwise it will disappear in smoke.
Now you want to find an optimal strategy to destroy all obstacles and consume minimum vitality.
输入数据
输出数据
For each test case output the answer as described previously.
样例输入
复制
2
3
1 1 2 2
2 -1 1 4
3 -2 -1 3
3
1 -1 1 2
2 -1 1 3
3 0 2 0
样例输出
样例说明
The first testcase as shown in the picture:
$ Mathjax font initiator $