#P6247. Closest and Farthest Points
Closest and Farthest Points
Closest and Farthest Points
Given n points in the plane with coordinates in a Cartesian coordinate system, your task is to compute the distance between the closest pair of points and the distance between the farthest pair of points. The distance between two points \( (x_1,y_1) \) and \( (x_2,y_2) \) is defined by the Euclidean distance formula:
\( d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2} \)
Please note that there will always be at least two points.
inputFormat
The input begins with an integer n (\( n \ge 2 \)), representing the number of points. The following n lines each contain two space-separated numbers which represent the coordinates \( x \) and \( y \) of a point.
outputFormat
Output two floating-point numbers: the minimum distance between any two points and the maximum distance between any two points. The values should be printed with 6 decimal places, separated by a space.
sample
2
0 0
3 4
5.000000 5.000000