#P4357. [CQOI2016] K 远点对

[CQOI2016] K 远点对

Description

Given the coordinates of NN points in the plane, find the KK-th farthest pair under the Euclidean distance.

The Euclidean distance between two points P(x1,y1)P(x_1,y_1) and Q(x2,y2)Q(x_2,y_2) is defined as (x1x2)2+(y1y2)2\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}.

Input Format

The first line contains two integers N,KN,K separated by a space.

The next NN lines each contain two integers X,YX,Y, representing the coordinates of a point.

Output Format

Output a single integer on the first line, which is the square of the distance of the KK-th farthest pair (it is guaranteed to be an integer).

10 5
0 0
0 1
1 0
1 1
2 0
2 1
1 2
0 2
3 0
3 1
9

Hint

For 100%100\% of the testdata, $N \le 100000,1 \le K \le 100,K \le \dfrac {N(N-1)}{2},0 \le X,Y < 2^{31}$.

Translated by ChatGPT 5