結果

問題 No.3154 convex polygon judge
ユーザー detteiuu
提出日時 2025-05-20 22:14:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 954 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 81,936 KB
実行使用メモリ 113,500 KB
最終ジャッジ日時 2025-05-20 22:15:06
合計ジャッジ時間 7,809 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

def e(a,b,c):return(b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0])
def c(a):
    b=[]
    for p in a:
        while len(b)>1 and e(b[-1],b[-2],p)>=0:b.pop()
        b.append(p)
    t=len(b)
    for i in range(len(a)-2,-1,-1):
        while len(b)>t and e(b[-1],b[-2],a[i])>=0:b.pop()
        b.append(a[i])
    return b
n=int(input())
print("Yes"if len(c(sorted([list(map(int,input().split()))for _ in range(n)])))==n+1 else"No")
0