#P4637. [SHOI2011] 扫雷机器人
[SHOI2011] 扫雷机器人
Description
Minesweeping is an important and dangerous task on the army battlefield. For this purpose, the AL military factory specially developed a minesweeping robot. This robot is designed specifically for linear minefields. A so-called linear minefield means that all mines are buried on the same straight line. For example, in the figure, the minefield marked by black dots is a linear minefield.

The AL military factory’s minesweeping robot has only one method to clear mines: safe detonation. Each time, the robot chooses one mine among all detected mines to detonate. The detonated mine will in turn detonate other mines that are within its blast range. These indirectly detonated mines can further cause chain explosions. For example, in the figure, a circle radius represents a mine’s blast range. If mine is detonated, mines and will explode; if mine is detonated, all mines will explode; but if mine is detonated, then only mine will explode.
Even for a robot, detonation is dangerous. Therefore, the buyer hopes that in real combat the robot can use a clearing plan that destroys all mines with as few detonations as possible. So the AL military factory wants to test the robot on this aspect. To evaluate the robot’s performance, the AL military factory plans to compute in advance: in a linear minefield (i.e., the input minefield), if detonations are performed randomly, the expected number of detonations needed to finish clearing all mines. This value will then be compared with the robot’s actual clearing plan to evaluate its performance.
“Random detonation” means that each time, one mine is chosen uniformly at random among all mines that have not been detonated, and then detonated. After the chain reaction caused by this detonation ends, if there are still mines that have not been detonated, repeat the above operation until all mines have been detonated.
Input Format
The first line contains a positive integer , the number of mines.
The next lines describe the mines in order of their positions, one mine per line. On line , there are two integers and , representing the coordinate of the mine and its blast power. That is, mine can directly detonate mine if . The input guarantees: , .
Output Format
Output one line containing one real number, which is the answer. Round to four digits after the decimal point.
4
0 1
2 2
8 7
11 2
2.3333
3
-10 10
0 1
10 10
2.3333
2
1 10
2 100
1.0000
9
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
1000 2000
1.8889
Hint
Hint
In the problem directory, there are additional input sample files robot20111.in~robot201110.in and their corresponding output sample files robot20111.out~robot201110.out. These files satisfy all constraints in this problem, but they are not the final testdata.
Download link, password: ypbv.
Scoring
For each test point, if your output is and the standard answer is , then:
- When , you get points for that test point.
- When , you get points.
- When , you get points.
- Otherwise, you get points.
Constraints
Test point : .
Test point : , and any strategy guarantees that the number of detonations does not exceed .
Test point : .
Test points : , and any strategy guarantees that the number of detonations does not exceed .
Test points : .
Translated by ChatGPT 5
京公网安备 11011102002149号