406838: GYM102569 C Manhattan Distance

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Manhattan Distancetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Manhattan distance between two points $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ is defined as $$$|x_1 - x_2| + |y_1 - y_2|$$$.

There are $$$n$$$ pairwise distinct points on a plane. Consider all unordered pairs of these points, there are $$$\frac{n\left(n-1\right)}{2}$$$ such pairs in total. For every pair of points it is possible to calculate Manhattan distance between them. We don't ask you to calculate all such distances. Just output the $$$k$$$-th of them in increasing order.

Input

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 100000, 1 \le k \le \frac{n\left(n-1\right)}{2}$$$) — the number of points and the sequence number of the distance you have to output.

Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$-10^8 \le x_i, y_i \le 10^8$$$) — the coordinates of the points. It is guaranteed that all $$$n$$$ points are pairwise distinct.

Output

Output the $$$k$$$-th Manhattan distance in increasing order among all unordered pairs of points.

ExamplesInput
4 3
0 0
3 0
0 2
2 3
Output
3
Input
4 4
0 0
3 0
0 2
2 3
Output
4
Input
4 5
0 0
3 0
0 2
2 3
Output
5

加入题单

上一题 下一题 算法标签: