Problem D
Subway
Input: standard input
Output: standard output
Time Limit: 4 seconds
The
government in a foreign land is looking into the possibility of establishing a
subway system in its capital. Because of practical reasons, they would like
each subway line to start at the central station and then go in a straight line
in some angle as far as necessary. You have been hired to investigate whether
such an approach is feasible. You have been given the coordinates of important
places in the city which must lie close to a subway station (possibly the
central station). Exactly how close they must lie is determined by another
parameter, also given. Your job is to calculate the minimum number of subway
lines needed to satisfy the demands of the government. You may assume that any
number of subway stations can be built along a subway line.
/*The figure above corresponds to the first sample input*/
For
each data set, output a single integer on a line by itself: the minimum number
of subway lines needed to make sure all important places in the city is at a
distance of at most d from a subway station.
2 7 1 -1 -4 -3 1 -3 -1 2 3 2 4 2 -2 6 -2 4 0 0 4 -12 18 0 27 -34 51 |
4 2
|
Problem setter: Jimmy Mårdell, Member of
Elite Problemsetters' Panel