#P4766. [CERC2014] Outer space invaders
[CERC2014] Outer space invaders
题目描述
The aliens from outer space have (finally!) invaded Earth. Defend yourself, or be disintegrated!
Or assimilated. Or eaten. We are not yet sure.
The aliens follow a known attack pattern. There are attackers, the one appears at time , at distance from you. He must be destroyed no later than at time , or else he will fire his weapon, which will definitely end the fight.
Your weapon is an area-blaster, which can be set to any given power. If fired with power ,it momentarily destroys all aliens at distance or smaller. It also consumes fuel cells.
Determine the minimal cost (measured in fuel cells) of destroying all the aliens, without being killed.
输入格式
The first line of input contains the number of test cases . The descriptions of the test cases follow:
Each test case starts with a line containing the number of aliens . Of the next lines, the one contains three integers $a_i, b_i, d_i, (1 \le a_i < b_i \le 10 000, 1 \le d_i \le 10 000)$.
The alien appears at time , is idle until , and his distance from you is .
输出格式
For each test case, output one line containing the minimum number of cells needed to destroy all the aliens.
1
3
1 4 4
4 7 5
3 4 7
7