結果
| 問題 | No.3154 convex polygon judge |
| コンテスト | |
| ユーザー |
catupper
|
| 提出日時 | 2025-05-20 21:58:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 1,569 ms / 2,000 ms |
| コード長 | 531 bytes |
| 記録 | |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 95,856 KB |
| 実行使用メモリ | 123,176 KB |
| 最終ジャッジ日時 | 2026-07-10 21:40:11 |
| 合計ジャッジ時間 | 12,411 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
N = int(input())
points = [tuple(map(int,input().split())) for _ in range(N)]
points.sort()
from functools import cmp_to_key
def ccw(a,b,c):
ax,ay = a
bx,by = b
cx,cy = c
bx -= ax
cx -= ax
by -= ay
cy -= ay
crs = bx*cy-cx*by
if crs > 0:return 1
if crs < 0: return -1
return 0
p = points.pop()
def cmp(a,b):
return ccw(p, a, b)
points.sort(key=cmp_to_key(cmp))
points.append(p)
ccws=[ccw(points[i-2],points[i-1],points[i]) == -1 for i in range(N)]
if all(ccws):
print("Yes")
else:
print("No")
catupper