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

6620번 - Simple Polygon 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 128 MB64242167.742%

문제

A polygon P determined by points p1, p2, . . . , pn is a closed chain of line segments (called edges) p1p2, p2p3, . . . , pnp1 in the plane. Polygon P is simple, if no two edges have any points in common, with the obvious exception of two consecutive segments having one common point (called vertex). Note however, that if a vertex is part of any other (third) edge, the polygon is no longer simple.

Any polygon that is not simple is called self-intersecting. In two example figures below, the first polygon is simple, the second one is self-intersecting.

Your task is to determine whether a given polygon is simple or self-intersecting.

입력

The input contains several test cases. Each test case corresponds to one polygon. First line of the test case contains N, the number of points (1 ≤ N ≤ 40 000). Each of the following N lines contains coordinates of point Pi, that is Xi, Yi separated by space, 1 ≤ Xi,Yi ≤ 30 000.

The last test case is followed by a line containing zero.

출력

For each test case output either “YES” (the polygon is simple) or “NO” (the polygon is self-intersecting).

제한

예제 입력 1

5
1 6
5 7
9 4
2 3
6 1
7
1 6
5 7
9 4
4 3
7 4
4 6
3 1
7
1 1
1 4
1 3
2 2
3 1
3 3
2 2
0

예제 출력 1

NO
YES
NO

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CTU Open Contest > CTU Open Contest 2011 G번

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

출처

대학교 대회

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

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