結果

問題 No.199 星を描こう
ユーザー maspy
提出日時 2020-03-05 08:37:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 491 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,456 KB
最終ジャッジ日時 2024-10-14 00:45:32
合計ジャッジ時間 15,018 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools

# %%
import numpy as np

# %%
XY = np.array(read().split(), np.int64)
X = XY[::2]
Y = XY[1::2]

# %%


def is_edge_of_convexhull(i, j):
    b = X[i] - X[j]
    a = Y[j] - Y[i]
    c = a * X[i] + b * Y[i]
    return np.count_nonzero(a * X + b * Y - c > 0) == 3


# %%
n = 0
it = itertools.product(range(5), repeat=2)
n = sum(is_edge_of_convexhull(i, j) for i, j in it if i != j)
print('YES' if n == 5 else 'NO')
0