結果
| 問題 | 
                            No.199 星を描こう
                             | 
                    
| コンテスト | |
| ユーザー | 
                             n_knuu
                         | 
                    
| 提出日時 | 2015-04-29 16:53:36 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,415 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 12,928 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-05 16:42:10 | 
| 合計ジャッジ時間 | 1,516 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 WA * 6 | 
ソースコード
eps = 1e-10
def add(a, b):
    return 0 if abs(a + b) < eps * (abs(a) + abs(b)) else a + b
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y
    def __add__(self, p):
        return Point(add(self.x, p.x), add(self.y, p.y))
    def __sub__(self, p):
        return Point(add(self.x, -p.x), add(self.y, -p.y))
    def __mul__(self, d):
        return Point(self.x * d, self.y * d)
    def dot(self, p):
        return add(self.x * p.x, self.y * p.y)
    def det(self, p):
        return add(self.x * p.y, -self.y * p.x)
    def __str__(self):
        return "({}, {})".format(self.x, self.y)
from functools import cmp_to_key
def cmp_x(p, q):
    return p.x < p.y if p.x != q.x else p.y < q.y
def convex_hell(ps, n):
    """ P(x, y) : point P
        n : number of point
    """
    ps.sort(key=cmp_to_key(cmp_x))
    k = 0
    qs = [[] for _ in range(2*n)]
    for i in range(n):
        while k > 1 and (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0:
            k -= 1
        qs[k] = ps[i]
        k += 1
    t = k
    for i in range(n-2, -1, -1):
        while k > t and (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0:
            k -= 1
        qs[k] = ps[i]
        k += 1
    qs = qs[:-qs.count([])]
    return qs
qs = []
for i in range(5):
    x, y = map(int, input().split())
    qs.append(Point(x, y))
qs = convex_hell(qs, 5)
print('YES' if len(qs) == 6 else 'NO')
            
            
            
        
            
n_knuu