传统题 1000ms 256MiB

F - Dist Max 2

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

F - Dist Max 2

Score : $500$ points

Problem Statement

Given are $N$ distinct points in a two-dimensional plane. Point $i$ $(1 \leq i \leq N)$ has the coordinates $(x_i,y_i)$.

Let us define the distance between two points $i$ and $j$ be $\mathrm{min} (|x_i-x_j|,|y_i-y_j|)$: the smaller of the difference in the $x$-coordinates and the difference in the $y$-coordinates.

Find the maximum distance between two different points.

Constraints

  • $2 \leq N \leq 200000$
  • $0 \leq x_i,y_i \leq 10^9$
  • $(x_i,y_i)$ $\neq$ $(x_j,y_j)$ $(i \neq j)$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

x1x_1 y1y_1

x2x_2 y2y_2

\vdots

xNx_N yNy_N

Output

Print the maximum distance between two different points.


3
0 3
3 1
4 10
4

The distances between Points $1$ and $2$, between Points $1$ and $3$, and between Points $2$ and $3$ are $2$, $4$, and $1$, respectively, so your output should be $4$.


4
0 1
0 4
0 10
0 6
0

8
897 729
802 969
765 184
992 887
1 104
521 641
220 909
380 378
801

2024寒假入门组刷题营(十三)

未参加
状态
已结束
规则
ACM/ICPC
题目
8
开始于
2024-2-13 13:30
结束于
2024-2-13 15:30
持续时间
2 小时
主持人
参赛人数
10