| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 | 2048 MB | 1 | 1 | 1 | 100.000% |
The Society for Beyond-Earth Cosmonautics (SBC) is training its teams for the next edition of the International Challenge of Planetary Cosmonautics (ICPC).
SBC will conduct a simulated exploration of a distant galaxy called Quadrameda. For this mission, $N$ stars were selected for their geometrically strategic locations, and a visitation order was determined, numbered from 1ドル$ to $N$. To prepare the teams, simplified models are used, in which each star is represented by a point in the plane with integer coordinates $(x_i , y_i)$.
The stars are arranged so that, for each 1ドル ≤ i < N,ドル star $i$ is aligned with star $i + 1,ドル that is, they share the same $x$ coordinate or the same $y$ coordinate.
The mission’s objective is to orbit each star $i$ along a circle of constant integer radius $R_i ≥ 1$. During the simulation, the spacecraft orbits the current star and, upon reaching the point of the orbit closest to the next star, leaves this orbit and immediately begins orbiting the following star. For this maneuver to be possible, for each 1ドル ≤ i < N,ドル the radius $R_i$ must be strictly less than the Euclidean distance between stars $i$ and $i + 1$.
The example below illustrates a valid orbit configuration with $N = 3$; the stars are at the points $(0, 0),ドル $(4, 0)$ and $(4, 4)$. In this configuration, we have $R_1 = 1,ドル $R_2 = 3$ and $R_3 = 1$.
Your task is to determine the largest integer value of $R_1$ such that it is possible to choose values $R_1, R_2, \dots , R_N$ that satisfy all the conditions above. If no valid orbit configuration exists, report that the mission is impossible.
The first line contains an integer $N$ (2ドル ≤ N ≤ 10^5$), the number of stars.
Each of the next $N$ lines contains two integers $x_i$ and $y_i$ ($|x_i |, |y_i | ≤ 10^9$), the coordinates of star $i$. For each 1ドル ≤ i < N,ドル stars $i$ and $i + 1$ are aligned horizontally or vertically.
Your program should produce a single line containing the largest integer value of $R_1$ such that a valid orbit configuration exists, or -1 if the mission is impossible.
3 0 0 4 0 4 4
3
5 0 0 4 0 4 2 4 6 6 6
-1
4 0 0 4 0 4 4 4 7
2