You will be given $N$ pair of coordinates on a 2D space. You will determine distance between the closest pair of points.
The distance between any two points is calculated as:
The input will start with $N$ ($1 \le N \le 1000$), the number of coordinates. Then $N$ lines will follow, each with a pair of integers $X_i$ and $Y_i$ ($-1000 \le X_i, Y_i \le 1000$) representing the $x$ and $y$ coordinates of the points.
Print the distance between the closest pair from among the given points. Absolute or relative error greater than $10^{-4}$ will be ignored.
Input | Output |
---|---|
3 1 1 2 7 3 5 | 2.23606797749979 |
The two closest points are $(2, 7)$ and $(3, 5)$. The distance between these two points is 2.23606797749979. |