#P1610. 鸿山洞的灯
鸿山洞的灯
Description
There are lamps with positions , and all are distinct. When the distance between two lamps is less than , if there is still a lamp that remains on within this safety distance, you may turn off those lamps (that is, if the distance between the -th and -th lamps is , then the -th lamp can be turned off).
While ensuring that the cave remains sufficiently illuminated, find the maximum number of lamps that can be removed within a single contiguous interval.
The lamps nearest to and farthest from the cave entrance must remain on.
Input Format
The first line contains two numbers, and .
The second line contains numbers, the positions of each lamp.
Output Format
Output one number: the maximum number of lamps that can be removed within a single interval.
3 3
1 2 3
1
Hint
For of the testdata, , and is guaranteed to be within the range of int.
Translated by ChatGPT 5
京公网安备 11011102002149号