結果
問題 |
No.3154 convex polygon judge
|
ユーザー |
![]() |
提出日時 | 2025-05-20 22:08:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 911 ms / 2,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 307 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 113,496 KB |
最終ジャッジ日時 | 2025-05-20 22:08:27 |
合計ジャッジ時間 | 7,986 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
def cross3(a,b,c):return(b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0]) def convex_hull(ps): qs=[] L=len(ps) for p in ps: while len(qs)>1 and cross3(qs[-1],qs[-2],p)>=0:qs.pop() qs.append(p) t=len(qs) for i in range(L-2,-1,-1): p=ps[i] while len(qs) > t and cross3(qs[-1], qs[-2], p) >= 0:qs.pop() qs.append(p) return qs N=int(input()) print("Yes"if len(convex_hull(sorted([list(map(int,input().split()))for _ in range(N)])))==N+1 else"No")