結果

問題 No.199 星を描こう
ユーザー nebukuro09nebukuro09
提出日時 2016-10-31 10:51:07
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 6,580 KB
実行使用メモリ 6,112 KB
最終ジャッジ日時 2023-08-28 18:49:55
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,952 KB
testcase_01 AC 11 ms
5,896 KB
testcase_02 AC 10 ms
6,020 KB
testcase_03 AC 11 ms
5,948 KB
testcase_04 AC 11 ms
6,008 KB
testcase_05 AC 11 ms
5,860 KB
testcase_06 AC 11 ms
6,012 KB
testcase_07 AC 11 ms
6,044 KB
testcase_08 AC 11 ms
6,068 KB
testcase_09 AC 11 ms
5,952 KB
testcase_10 AC 10 ms
6,004 KB
testcase_11 AC 10 ms
6,048 KB
testcase_12 AC 10 ms
5,944 KB
testcase_13 AC 11 ms
5,924 KB
testcase_14 AC 11 ms
5,864 KB
testcase_15 AC 11 ms
6,072 KB
testcase_16 AC 10 ms
5,948 KB
testcase_17 AC 10 ms
5,892 KB
testcase_18 AC 10 ms
5,920 KB
testcase_19 AC 10 ms
6,092 KB
testcase_20 AC 12 ms
6,056 KB
testcase_21 AC 12 ms
5,948 KB
testcase_22 AC 12 ms
6,112 KB
testcase_23 AC 12 ms
5,972 KB
testcase_24 AC 10 ms
6,012 KB
testcase_25 AC 11 ms
5,984 KB
testcase_26 AC 11 ms
6,004 KB
testcase_27 AC 10 ms
6,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
P = [map(int, raw_input().split()) for _ in xrange(5)]
crs = lambda p1, p2: p1[0]*p2[1]-p1[1]*p2[0]
v = lambda p1, p2: [p2[0]-p1[0], p2[1]-p1[1]]
def inside(a, b, c, d):
    g1 = crs(v(c, a), v(a, d))
    g2 = crs(v(a, b), v(b, d))
    g3 = crs(v(b, c), v(c, d))
    return (g1 >= 0 and g2 >= 0 and g3 >= 0) or (g1 <= 0 and g2 <= 0 and g3 <= 0)
for a, b, c, d, e in permutations(range(5)):
    if inside(P[a], P[b], P[c], P[d]) or inside(P[a], P[b], P[c], P[e]):
        print 'NO'
        exit()
print 'YES'
0