#P3299. [SDOI2013] 保护出题人
[SDOI2013] 保护出题人
Description
The problem setter Mingming felt that making problems for SDOI2012 was too scary because he would always be blamed, so he made problems again for SDOI2013.
The kids who participated in SDOI2012 released many zombies, trying to attack Mingming’s home. As a contestant of SDOI2013, you need to protect the problem setter Mingming.
Zombies approach along a single straight road. You need to place plants in front of Mingming’s door to attack the zombies, preventing them from reaching the house.
Level 1: a single zombie with HP starts uniformly approaching from meters away, and you place a plant with attack power points/second to defend. Level 2: based on the previous level, add a new zombie with HP to the front of the queue, at distance from the next zombie, and the front zombie starts uniformly approaching from meters away; you re-place a plant with attack power points/second. ... Level : there are zombies in total, adjacent zombies are meters apart, the front zombie has HP , the second has HP , and so on. The front zombie starts uniformly approaching from meters away, and the other zombies follow while approaching at the same time. You re-place a plant with attack power points/second.
Each zombie moves in a straight line at speed m/s. Since the plants’ firing speed is much higher than the zombies’ movement speed, the bullet travel time in the air can be ignored. All zombies appear and start approaching at the same time. Therefore, when one zombie dies, the next zombie immediately starts taking damage from the plant.
The game score depends on the total attack power you place, . The smaller the sum, the higher the score. To pursue the best possible score, you should place plants with the smallest possible attack power at every level.
As a contestant of SDOI2013, can you protect the problem setter?
Input Format
The first line contains two space-separated positive integers and , representing the number of levels and the distance between adjacent zombies.
The next lines each contain two space-separated positive integers. The -th line contains and , meaning that compared to the previous level, a new zombie with HP is added to the front of the queue, and the front zombie starts approaching from a distance of meters from the house.
Output Format
Output an integer: the minimal total attack power over the levels, rounded to the nearest integer.
5 2
3 3
1 1
10 8
4 8
2 3
7
Hint
Level 1: there is one zombie with HP at distance meters from the house, and the minimal plant attack power is .
Level 2: there is one zombie with HP at meter and one zombie with HP at meters, and the minimal plant attack power is .
Level 3: there is one zombie with HP at meters, one with HP at meters, and one with HP at meters, and the minimal plant attack power is .
Level 4: there is one zombie with HP at meters, one with HP at meters, one with HP at meters, and one with HP at meters, and the minimal plant attack power is .
Level 5: there is one zombie with HP at meters, one with HP at meters, one with HP at meters, one with HP at meters, and one with HP at meters, and the minimal plant attack power is .
The minimal total plant attack power is .
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号