問題一覧 > 通常問題

No.3759 Watch Fireworks

レベル : / AI推定難易度 : 1850 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 40
作問者 : ei1333333 / テスター : kyoprouno ei13333333
お気に入りにしたユーザー ProblemId : 13938 / 自分の提出
問題文最終更新日: 2026-10-03 03:33:20
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 517 (順位表) の他の問題:

Problem Statement

Kaguya and Iroha are attending a fireworks festival.

Before the festival begins, Kaguya and Iroha each choose $1$ point of their liking on the $xy$-plane and move there. The coordinates of the chosen points may be real numbers, and the $2$ people may choose the same point.

At the festival, $N$ fireworks are launched. The $i$-th firework is launched from the point with coordinates $(X_i,Y_i)$.

For a certain non-negative real number $D$, a person at a point whose Manhattan distance from the point where a firework is launched is at most $D$ can see that firework.

Let $D_{\min}$ be the minimum value of $D$ such that every firework can be seen by at least one of Kaguya and Iroha. Find $2D_{\min}$ (this value is always an integer).

Constraints

  • $1 \leq N \leq 3 \times 10^5$
  • $0 \leq X_i, Y_i \leq 10^9$
  • If $i \neq j$, then $(X_i, Y_i) \neq (X_j, Y_j)$
  • All input values are integers

Input

$N$
$X_1$ $Y_1$
$X_2$ $Y_2$
$:$
$X_N$ $Y_N$

Output

Output the answer on $1$ line.

Sample

Sample 1
Input
3
0 0
1 0
2 0
Output
1

Suppose Kaguya is at $(0.5, 0)$ and Iroha is at $(2, 0)$. Then the Manhattan distances between each firework and the $2$ people are as follows.

  • Firework 1 $(0, 0)$: the distance from Kaguya is $0.5$
  • Firework 2 $(1, 0)$: the distance from Kaguya is $0.5$
  • Firework 3 $(2, 0)$: the distance from Iroha is $0$

Since every firework is within distance $0.5$ of one of them, $D = 0.5$ satisfies the condition.

This is the minimum, so $D_{\min} = 0.5$. Therefore, the value $2D_{\min}$ to output is $1$.

Sample 2
Input
4
0 0
0 4
4 0
4 4
Output
4

For example, if Kaguya is at $(0,2)$ and Iroha is at $(4,2)$, every firework can be seen by at least one of them.

Sample 3
Input
1
0 0
Output
0

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。