結果
問題 | No.199 星を描こう |
ユーザー |
![]() |
提出日時 | 2021-05-22 23:05:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 868 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 82,028 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-10-10 23:51:11 |
合計ジャッジ時間 | 2,224 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
def convex_hull(points): def cross(i,j,k): """ ベクトル ij と ベクトル ik の内積(正なら班時計周り) """ xi,yi = points[i] xj,yj = points[j] xk,yk = points[k] return (xj-xi)*(yk-yi) - (yj-yi)*(xk-xi) n = len(points) points.sort() lst = [] for i in range(n): while len(lst) > 1 and cross(lst[-2],lst[-1],i) >= 0: #イコールをはずすと同一直線上を許す(その場合でも下側のイコールははずすな) lst.pop() lst.append(i) t = len(lst) for i in range(n-1)[::-1]: while len(lst) > t and cross(lst[-2],lst[-1],i) >= 0: lst.pop() lst.append(i) return lst[:-1] xy = [tuple(map(int,input().split())) for _ in range(5)] lst = convex_hull(xy) print("YES" if len(lst)==5 else "NO")