#P4357. Kth Farthest Pair
Kth Farthest Pair
Kth Farthest Pair
Given N points in the plane, find the Kth farthest pair of points in terms of the Euclidean distance. The Euclidean distance between two points \(P(x_1,y_1)\) and \(Q(x_2,y_2)\) is defined as:
\(\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}\)
Consider every pair of points (each pair counted separately even if the distance is the same), sort these distances in descending order and output the Kth distance in the sorted order. The answer should be printed with 6 decimal digits.
inputFormat
The first line of input contains two integers N and K separated by a space.
Each of the next N lines contains two integers representing the coordinates of a point in the plane.
It is guaranteed that 1 ≤ K ≤ N*(N-1)/2.
outputFormat
Output the Euclidean distance of the Kth farthest pair, formatted to 6 decimal places.
sample
4 3
0 0
0 1
1 0
1 1
1.000000