Under construction

Still being built. Things may change

Cartesian

Time limit10sMemory limit1024 MB

Summary
Given n points, pick k disjoint pairs so the common intersection of their bounding rectangles is a square; find the largest possible side length.
Level

Hard9 of 10

Topics
Binary search, Dynamic programming, Sorting
Solved
No attempts yet

Problem

The Cartesian kingdom lies on a plane with Cartesian coordinates (x,y)(x, y). The kingdom extends infinitely in all directions.

The king wants to build a new palace. The palace is a square with sides parallel to the coordinate axes. The palace can be as large as needed, but the king cares more about its safety.

The kingdom has nn guard posts, and the ii-th post is at (xi,yi)(x_i, y_i). The king can assign several guard groups to patrol the borders of the palace. The guards can only follow fairly simple orders. Each group must be assigned exactly two different posts. The group then patrols the smallest axis-parallel rectangle that contains those two posts. This rectangle may have zero area, for example when the two posts share an xx or a yy coordinate. To avoid confusion and conflicts, each post can be assigned to at most one group.

To feel safe enough, the king wants to form exactly kk guard groups. The palace must lie inside every rectangle patrolled by a group. That is, every point of the palace must be inside or on the boundary of each patrolled rectangle. Find the largest possible side length of a palace that can be built under these conditions.

Input

The first line contains two integers nn and kk (2≤n≤500002 \le n \le 50000, 1≤k≤n/21 \le k \le n/2), the number of posts and the number of groups required.

Each of the next nn lines contains two integers xix_i and yiy_i (−106≤xi,yi≤106-10^6 \le x_i, y_i \le 10^6), the coordinates of a post.

It is guaranteed that no two posts are at the same point.

Output

Print one number, the largest possible side length of the palace. If no palace with nonzero area satisfies the safety requirements, print 00.

Hints

The pictures show the palace and guard routes for the first two examples. In the third example, the only possible route forms a segment, so a palace with nonzero side length cannot be obtained.

Examples3

  1. Example 1

    Input
    4 1
    0 1
    3 0
    4 3
    1 4
    
    Expected output
    2
    
  2. Example 2

    Input
    5 2
    4 0
    2 4
    -4 1
    -1 2
    -3 5
    
    Expected output
    3
    
  3. Example 3

    Input
    2 1
    0 0
    10 0
    
    Expected output
    0