1193-radar Installation
Time limit:3.000 seconds
http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=3634
http://poj.org/problem?id=1328
Assume the coasting is a infinite straight line. Land are in one side of coasting, sea in the other. Each small island are a point locating the sea side. and any radar installation, locating on the coasting, can only cover d distance, so a island in the sea can be C Overed by a RADIUS installation, if the distance between them are at most D .
We use Cartesian coordinate system and defining the coasting is the x -axis. The sea side are above x -axis, and the land side below. Given the position of each island in the sea, and Given the distance of the coverage of the radar installation, your task is to write a program to find the minimal number of radar installations to cover all the islands. Note that the position of a island is represented by its x -y coordinates.
Input
The input consists of several test cases. The ' a ' of each case contains two integers n (1
N
1000) and D , where n is the number of islands in the sea and D are the distance of coverage of T He radar installation. This is followed by n lines each containing two integers representing the coordinate of the position of each Isla nd. Then a blank line follows to separate the cases.
The input is terminated by a line containing pair of zeros.
Output
For each test case output one line consisting of the "test Case number followed" by the minimal number of radar installation S needed. '-1' installation means no solution for this case.
Sample Input
3 2
1 2 to 3 1 2 1 1 2 0 2 0 0