結果

問題 No.199 星を描こう
ユーザー convexineqconvexineq
提出日時 2020-12-18 18:53:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 53,472 KB
最終ジャッジ日時 2023-10-21 08:12:44
合計ジャッジ時間 2,416 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,472 KB
testcase_01 AC 37 ms
53,472 KB
testcase_02 AC 35 ms
53,472 KB
testcase_03 AC 38 ms
53,472 KB
testcase_04 AC 36 ms
53,472 KB
testcase_05 AC 36 ms
53,472 KB
testcase_06 AC 36 ms
53,472 KB
testcase_07 AC 36 ms
53,472 KB
testcase_08 AC 37 ms
53,472 KB
testcase_09 AC 36 ms
53,472 KB
testcase_10 AC 37 ms
53,472 KB
testcase_11 AC 39 ms
53,472 KB
testcase_12 AC 35 ms
53,472 KB
testcase_13 AC 36 ms
53,472 KB
testcase_14 AC 34 ms
51,968 KB
testcase_15 AC 36 ms
52,180 KB
testcase_16 AC 37 ms
53,472 KB
testcase_17 AC 38 ms
52,148 KB
testcase_18 AC 39 ms
52,164 KB
testcase_19 AC 38 ms
52,160 KB
testcase_20 AC 35 ms
51,944 KB
testcase_21 AC 34 ms
52,216 KB
testcase_22 AC 36 ms
52,012 KB
testcase_23 AC 37 ms
51,956 KB
testcase_24 AC 36 ms
52,236 KB
testcase_25 AC 36 ms
52,228 KB
testcase_26 AC 35 ms
51,952 KB
testcase_27 AC 36 ms
52,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_opposit(p0,p1,p2,p3):
    x0,y0 = p0; x1,y1 = p1; x2,y2 = p2; x3,y3 = p3
    if ((x0-x1)*(y2-y0)+(y0-y1)*(x0-x2))*((x0-x1)*(y3-y0)+(y0-y1)*(x0-x3)) >= 0:
        return False
    else:
        return True

# 線分 p0--p1 と 線分 p2--p3 は交わるか?
# ただし一般の位置を仮定している
def is_crossed(p0,p1,p2,p3):
    return is_opposit(p0,p1,p2,p3) and is_opposit(p2,p3,p0,p1)

def is_star(a):
    for i in range(5):
        if not is_crossed(a[i],a[(i+2)%5],a[(i+1)%5],a[(i+3)%5]): return False
    return True

xy = [list(map(int,input().split())) for _ in range(5)]
from itertools import permutations
for a in permutations(xy):
    if is_star(a):
        print("YES")
        exit()
print("NO")
0