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

16192번 - Voronoi Diagram Returns 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 (추가 시간 없음) 1024 MB28415814056.225%

문제

Figure: Voronoi Diagram of size 4.

In the 2-dimensional Cartesian coordinate system, we define the Voronoi Diagram of a non-empty set of points $S,ドル as a diagram that divides the plane by the criteria "which point in the set $S$ is closest in this location?". More precisely, the Voronoi diagram of a given non-empty point set $\{P_1,\ P_2,\ \cdots,\ P_n\}$ is a collection of regions: A point $K$ is included in region $i$ if and only if $d(P_i,\ K) \le d(P_j,\ K)$ holds for all 1ドル \le j \le n,ドル where $d(X,\ Y)$ denotes the Euclidean distance between point $X$ and $Y$.

For example, in the picture above, every location over the plane is colored by the closest point with such location. The points which belongs to a single region is colored by a light color indicating a region, and the points which belongs to more than one region forms lines and points colored black.

There is an algorithm which computes the Voronoi Diagram in $\mathcal{O}(n \log(n)),ドル but it is infamous to be very complicated and hard. In fact, we are lenient problem setters, so we set $n \leq 2000,ドル which means you can solve this task with slower Voronoi Diagram algorithms!

In this task, you should solve the point query problem in Voronoi diagram: in the Voronoi diagram constructed with the set of points $\{P_1,\ P_2,\ \cdots,\ P_n\},ドル you should determine which region(s) the point belongs to. More precisely, you will be given $q$ queries of points. For each query point, you should determine the following:

  • If it's not included in any region, output NONE.
  • If it's included in exactly one region, output REGION X, where X is the index of such region.
  • If it's included in exactly two regions, output LINE X Y, where X and Y (X < Y) are the indices of such two regions.
  • If it's included in three or more regions, output POINT.

입력

In the first line, the number of points consisting Voronoi diagram $n,ドル and the number of queries $q$ are given. (3ドル \le n \le 2, 000,\ 1 \le q \le 250, 000$)

In the $i$th line of next $n$ lines, two integers indicating $x$ and $y$ co-ordinate of $P_i$ are given. These are the points consisting the Voronoi diagram. All $n$ points are distinct. ($|x|,\ |y| \le 10,000$)

In the $j$th line of next $q$ lines, two integers indicating $x$ and $y$ co-ordinate of $Q_j$ are given. For each point $Q_j,ドル you should determine in which region(s) the given point belongs to. ($|x|,\ |y| \le 10,000$)

출력

Output consists of $q$ lines. In the $j$th line, you should print one of following:

  • If $Q_j$ is not included in any region, output NONE.
  • If $Q_j$ is included in exactly one region, output REGION X, where X is the index of such region.
  • If $Q_j$ is included in exactly two regions, output LINE X Y, where X and Y (X < Y) are the indices of such two regions.
  • If $Q_j$ is included in three or more regions, output POINT.

제한

예제 입력 1

4 3
-5 0
0 5
3 4
1 -6
-2 2
0 0
2 2

예제 출력 1

LINE 1 2
POINT
REGION 3

Example is illustrated as a diagram above.

힌트

출처

University > KAIST > KAIST ICPC Mock Competition > 2018 KAIST 8th ACM-ICPC Mock Competition L번

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

출처

대학교 대회

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

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