結果
| 問題 | No.3154 convex polygon judge | 
| コンテスト | |
| ユーザー |  timi | 
| 提出日時 | 2025-05-20 23:21:12 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 738 bytes | 
| コンパイル時間 | 1,012 ms | 
| コンパイル使用メモリ | 81,840 KB | 
| 実行使用メモリ | 102,748 KB | 
| 最終ジャッジ日時 | 2025-05-20 23:21:20 | 
| 合計ジャッジ時間 | 7,222 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 42 WA * 2 | 
ソースコード
N=int(input())
A=[]
for i in range(N):
  x,y=map(int, input().split())
  A.append((x,y))
  
A=sorted(A,key=lambda x: x[1])  
A=sorted(A,key=lambda x: x[0])  
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 = []
    N = len(ps)
    for p in ps:
        # 一直線上で高々2点にする場合は ">=" にする
        while len(qs) > 1 and cross3(qs[-1], qs[-2], p) >= 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(N-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
ans= convex_hull(A)
if len(ans)==N+1:
  print('Yes')
else:
  print('No')
            
            
            
        