結果

問題 No.635 自然門松列
ユーザー nebukuro09nebukuro09
提出日時 2018-05-19 04:50:42
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 6,628 KB
実行使用メモリ 7,860 KB
最終ジャッジ日時 2023-09-10 23:36:48
合計ジャッジ時間 3,600 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
7,760 KB
testcase_01 AC 22 ms
7,800 KB
testcase_02 WA -
testcase_03 AC 28 ms
7,684 KB
testcase_04 AC 23 ms
7,828 KB
testcase_05 AC 59 ms
7,764 KB
testcase_06 AC 59 ms
7,632 KB
testcase_07 AC 57 ms
7,828 KB
testcase_08 AC 27 ms
7,760 KB
testcase_09 AC 27 ms
7,756 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 42 ms
7,688 KB
testcase_13 AC 42 ms
7,676 KB
testcase_14 AC 42 ms
7,680 KB
testcase_15 WA -
testcase_16 AC 23 ms
7,748 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction


def is_kadomatsu(a, b, c):
    return b < a < c or b < c < a or b > a > c or b > c > a


def solve():
    x1, x2, x3, y1, y2, y3 = map(int, raw_input().split())
    T = []

    if y1 != y2:
        T.append(Fraction(x1-x2, y2-y1))
    if y2 != y3:
        T.append(Fraction(x2-x3, y3-y2))
    if y3 != y1:
        T.append(Fraction(x3-x1, y1-y3))

    d = Fraction(1, 10**18)

    for t in T:
        if t < 0:
            continue
        for sign in (1, -1):
            a1 = x1 + y1 * (t + sign * d)
            a2 = x2 + y2 * (t + sign * d)
            a3 = x3 + y3 * (t + sign * d)
            if is_kadomatsu(a1, a2, a3):
                return "YES"

    return "NO"


Q = input()
for _ in xrange(Q):
    print solve()
0