#C4045. Optimizing Delivery Hubs
Optimizing Delivery Hubs
Optimizing Delivery Hubs
You are given n delivery points on a 2D plane. Your task is to choose two hubs from these points in order to minimize the maximum distance from any delivery point to its nearest hub. The distance used is the Chebyshev distance, which between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is defined as:
[ d = \max\big(|x_1 - x_2|,,|y_1 - y_2|\big) ]
The answer to be reported is half the Chebyshev distance between the two chosen hubs. It is guaranteed that an optimal pair exists among the given points.
inputFormat
The input is provided from standard input (stdin). The first line contains an integer ( n ) representing the number of delivery points. Each of the next ( n ) lines contains two integers ( x ) and ( y ), the coordinates of a delivery point.
outputFormat
Output to standard output (stdout) consists of three lines:
- The minimized maximum distance (which is half the Chebyshev distance between the two selected hubs), printed with six decimal places.
- The coordinates of the first hub (two numbers) printed with six decimal places and separated by a space.
- The coordinates of the second hub (two numbers) printed with six decimal places and separated by a space.## sample
3
0 0
10 10
20 20
10.000000
0.000000 0.000000
20.000000 20.000000
</p>