#C7297. Closest Pair of Points

    ID: 51152 Type: Default 1000ms 256MiB

Closest Pair of Points

Closest Pair of Points

In this problem, you are given a set of n points on the 2D plane. Your task is to find the two points that are closest to each other and to compute the Euclidean distance between them. The Euclidean distance between two points ( (x_i, y_i) ) and ( (x_j, y_j) ) is defined as [ d_{ij} = \sqrt{(x_i - x_j)^2 + (y_i - y_j)^2} ]

You should output the smallest distance formatted to six decimal places. It is guaranteed that n will be at least 2.

inputFormat

The first line of input contains an integer n (n (\ge) 2), which represents the number of points. The following n lines each contain two space-separated integers, representing the x and y coordinates of a point.

outputFormat

Output a single line with the smallest Euclidean distance between any two points, formatted to six decimal places.## sample

2
0 0
3 4
5.000000