luogu#P5025. [SNOI2017] 炸弹
[SNOI2017] 炸弹
Problem Description
There are bombs on a straight line. The coordinate of each bomb is , and its explosion radius is . When a bomb explodes, if the position of another bomb satisfies:
, then that bomb will also be detonated.
Now, please help compute: if we detonate bomb first, how many bombs will be detonated in total?
The answer should be taken modulo .
Input Format
The first line contains an integer , representing the number of bombs.
Lines each contain two integers, representing and . It is guaranteed that is strictly increasing.
Output Format
Output one integer, representing the number of bombs that bomb can detonate.
4
1 1
5 1
6 5
15 15
32
Hint
Constraints
For of the testdata: .
For of the testdata: .
For of the testdata: .
For of the testdata: , , .
Translated by ChatGPT 5