Logo
(追記) (追記ここまで)

32827번 - Two Rings 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB74221323.636%

문제

As a planar shape, a ring can be described as the area between two concentric circles. This concept can of course be generalized to any possible shapes. For example, one might define rectangular rings to be the area between two rectangles. A precise definition of rectangular rings is as follows: Here, any rectangles we discuss is assumed to be axis-aligned, so the four sides of a rectangle are horizontal or vertical, and are distinguished as the left, right, top, and bottom sides. Any vertical or horizontal segment is also considered a rectangle with empty interior. A rectangular ring is the closed area between two rectangles $R$ and $R',ドル including the boundary, such that the following conditions are satisfied:

  1. $R'$ is contained in $R,ドル including the boundary of $R$.
  2. The following four values are equal: the distance between the top side of $R$ and the top side of $R',ドル the distance between the left side of $R$ and the left side of $R',ドル the distance between the bottom side of $R$ and the bottom side of $R',ドル and the distance between the right side of $R$ and the right side of $R'$.

The distance described in the second condition is called the width of the rectangular ring defined by two rectangles $R$ and $R'$. The figure below illustrates three rectangular rings of width $w$ defined by two rectangles $R$ and $R'$. Note that the first and third ones show two extreme and degenerate cases: $R' = R$ (thus, $w = 0$ and the rectangular ring is the boundary of $R' = R$) and $R'$ is a line segment (thus, $R$ is the rectangular ring).

Given a finite set $P$ of points in the plane, write a program that finds two non-penetrating rectangular rings $A_1$ and $A_2$ such that $P \subset A_1 \cup A_2$ and the larger of their widths is minimized. Two rectangular rings are called non-penetrating if one’s boundary neither intersects the other’s interior nor crosses the other’s boundary. Note that two non-penetrating rectangular rings still may touch in their boundaries in such a way that every point in the intersection between their boundaries lies in the intersection between two parallel sides of their defining rectangles or a corner.

The above figure shows (a) an example set $P$ of 22ドル$ points and (b) an optimal pair of two non-penetrating rectangular rings containing $P$ that minimizes the larger value of their widths.

입력

Your program is to read from standard input. The input starts with a line containing an integer, $n$ (1ドル ≤ n ≤300,000円$), where $n$ is the number of input points in $P$. In each of the following $n$ lines, there are two integers between $-10^9$ and 10ドル^9,ドル separated by a space, that describe the coordinates of a point in $P$. You may assume that no two input points are identical.

출력

Your program is to write to standard output. Print exactly one line. The line should contain an integer that describes the minimum possible value for the larger width of two non-penetrating rectangular rings that include all points of $P$.

제한

예제 입력 1

13
0 1
1 2
0 5
4 6
5 0
6 2
8 3
11 1
12 -1
13 2
12 4
10 3
3 4

예제 출력 1

1

예제 입력 2

13
0 1
1 2
0 5
4 6
5 0
6 2
8 3
11 -2
12 -4
13 -1
12 1
10 0
3 4

예제 출력 2

2

힌트

출처

ICPC > Regionals > Asia Pacific > Korea > Nationwide Internet Competition > Seoul Nationalwide Internet Competition 2024 J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /