No.3759 Watch Fireworks
タグ : / 解いたユーザー数 40
作問者 :
ei1333333
/ テスター :
kyoprouno
ei13333333
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もしくは右上の雲マークをクリックしてアカウントを作成してください。