結果
問題 |
No.3154 convex polygon judge
|
ユーザー |
![]() |
提出日時 | 2025-05-20 22:05:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 860 ms / 2,000 ms |
コード長 | 656 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 82,480 KB |
実行使用メモリ | 108,660 KB |
最終ジャッジ日時 | 2025-05-20 22:05:46 |
合計ジャッジ時間 | 7,799 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 upper = [] for p in points: while len(upper) >= 2 and ccw(upper[-2], upper[-1], p) >= 0: upper.pop() upper.append(p) lower = [] for p in points[::-1]: while len(lower) >= 2 and ccw(lower[-2], lower[-1], p) >= 0: lower.pop() lower.append(p) upper.pop() lower.pop() if len(upper) + len(lower) == N: print("Yes") else: print("No")