1907. Highway

单点时限: 2.0 sec

内存限制: 256 MB

Bob is a skilled engineer. He must design a highway that crosses a region with few villages. Since this region is quite unpopulated, he wants to minimize the number of exits from the highway. He models the highway as a line segment S (starting from zero), the villages as points on a plane, and the exits as points on S. Considering that the highway and the villages position are known, Bob must find the minimum number of exists such that each village location is at most at the distance D from at least one exit. He knows that all village locations are at most at the distance D from S.

输入格式

The program input is from a text file. Each data set in the file stands for a particular set of a highway and the positions of the villages. The data set starts with the length L (fits an integer) of the highway. Follows the distance D (fits an integer), the number N of villages, and for each village the location (x,y). The program prints the minimum number of exits.

输出格式

White spaces can occur freely in the input. The input data are correct and terminate with an end of file. For each set of data the program prints the result to the standard output from the beginning of a line. An input/output sample is in the table below. There is a single data set. The highway length L is 100, the distance D is 50. There are 3 villages having the locations (2, 4), (50, 10), (70, 30). The result for the data set is the minimum number of exits: 1.

样例

Input
100
50
3
2 4
50 10
70 30
Output
1

2 人解决,3 人已尝试。

2 份提交通过,共有 5 份提交。

8.7 EMB 奖励。

创建: 17 年,1 月前.

修改: 7 年,3 月前.

最后提交: 15 年前.

来源: Southeastern European Regional Programming Contest 2007

题目标签