結果
| 問題 |
No.3154 convex polygon judge
|
| コンテスト | |
| ユーザー |
catupper
|
| 提出日時 | 2025-05-20 21:54:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 550 bytes |
| コンパイル時間 | 549 ms |
| コンパイル使用メモリ | 82,712 KB |
| 実行使用メモリ | 120,752 KB |
| 最終ジャッジ日時 | 2025-05-20 21:55:06 |
| 合計ジャッジ時間 | 12,835 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 TLE * 4 |
ソースコード
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
p0 = points[0]
def cmp(a,b):
return ccw(p0, a, b)
ps = sorted(points[1:], key=cmp_to_key(cmp))
ps.append(p0)
ccws=[ccw(ps[i-2],ps[i-1],ps[i]) for i in range(N)]
if min(ccws) == max(ccws) and ccws[0] != 0:
print("Yes")
else:
print("No")
catupper