P6247 [SDOI2012] Nearest and Farthest Pair of Points
Description
Given $n$ points on the Cartesian coordinate plane, find the distance between the two closest points and the distance between the two farthest points. Note that the distance is the straight-line (Euclidean) distance.
Input Format
The first line contains an integer $n$.
The next $n$ lines each contain two non-negative floating-point numbers, $x_i$ and $y_i$, representing the $x$-coordinate and $y$-coordinate of the $i$-th point.
Output Format
Output one line with two floating-point numbers: the shortest distance and the longest distance. An error of at most $0.01$ is considered correct.
Explanation/Hint
- For $30\%$ of the testdata, $n \leq 2000$.
- For $70\%$ of the testdata, $n \leq 20000$.
- For $100\%$ of the testdata, $0 \lt n \leq 10^5$, and all numbers in the input are non-negative and do not exceed $10^9$ in value.
Translated by ChatGPT 5