#P6247. [SDOI2012] 最近最远点对

    ID: 5241 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2012各省省选山东Special Judge分治凸包K-D Tree

[SDOI2012] 最近最远点对

Description

Given nn 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 nn.
The next nn lines each contain two non-negative floating-point numbers, xix_i and yiy_i, representing the xx-coordinate and yy-coordinate of the ii-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.010.01 is considered correct.

4
0.0 0.0
0.0 1.0
1.0 0.0
1.0 1.0
1.00 1.41

Hint

  • For 30%30\% of the testdata, n2000n \leq 2000.
  • For 70%70\% of the testdata, n20000n \leq 20000.
  • For 100%100\% of the testdata, 0<n1050 \lt n \leq 10^5, and all numbers in the input are non-negative and do not exceed 10910^9 in value.

Translated by ChatGPT 5