293 传统题

[ABC330F] 最小包围正方形 (Minimize Bounding Square)

时间限制
3000ms
内存限制
512MiB
登顶 / 尝试
0/ 0
难度
5

[ABC330F] 最小包围正方形 (Minimize Bounding Square)

Problem Statement

There are NN points labeled 1,2,…,N1, 2, \dots, N on the xyxy-plane. Point ii is located at coordinates (Xi,Yi)(X_i, Y_i).

You can perform the following operation between 00 and KK times, inclusive.

  • First, choose one of the NN points. Let kk be the selected point, and assume it is currently at (x,y)(x, y).

  • Next, choose and execute one of the following four actions: Move point kk along the xx-axis by +1+1. The coordinates of point kk become (x+1,y)(x+1, y).

  • Move point kk along the xx-axis by −1-1. The coordinates of point kk become (x−1,y)(x-1, y).

  • Move point kk along the yy-axis by +1+1. The coordinates of point kk become (x,y+1)(x, y+1).

  • Move point kk along the yy-axis by −1-1. The coordinates of point kk become (x,y−1)(x, y-1).

  • It is allowed to have multiple points at the same coordinates. Note that the input may already have multiple points at the same coordinates.

After all your operations, draw one square that includes all the NN points inside or on the circumference, with each side parallel to the xx- or yy-axis.

Find the minimum possible value for the length of a side of this square. This value can be shown to be an integer since all points are always on lattice points.

In particular, if all points can be made to exist at the same coordinates, the answer is considered to be 00.

Input

Input is given from Standard Input in the following format:

$N$ $K$
$X_1$ $Y_1$
$X_2$ $Y_2$
$\vdots$
$X_N$ $Y_N$

Output

Print the answer as an integer.

Example

6 5
2 0
5 2
0 3
3 2
3 4
1 5
3

Note

  • Constraints:

  • All input values are integers.

  • 1≤N≤2×1051 \le N \le 2 \times 10^5

  • 0≤K≤4×10140 \le K \le 4 \times 10^{14}

  • 0≤Xi,Yi≤1090 \le X_i, Y_i \le 10^9

  • Source: ABC330F