結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
7,680 KB
testcase_01 AC 22 ms
7,684 KB
testcase_02 AC 24 ms
7,676 KB
testcase_03 AC 29 ms
7,796 KB
testcase_04 AC 23 ms
7,688 KB
testcase_05 AC 58 ms
7,636 KB
testcase_06 AC 59 ms
7,760 KB
testcase_07 AC 58 ms
7,808 KB
testcase_08 AC 28 ms
7,668 KB
testcase_09 AC 27 ms
7,680 KB
testcase_10 WA -
testcase_11 AC 33 ms
7,684 KB
testcase_12 AC 42 ms
7,688 KB
testcase_13 AC 43 ms
7,776 KB
testcase_14 AC 43 ms
7,752 KB
testcase_15 WA -
testcase_16 AC 24 ms
7,632 KB
testcase_17 AC 38 ms
7,788 KB
testcase_18 AC 38 ms
7,636 KB
testcase_19 AC 37 ms
7,796 KB
testcase_20 AC 37 ms
7,772 KB
testcase_21 AC 37 ms
7,668 KB
testcase_22 AC 39 ms
7,680 KB
testcase_23 AC 35 ms
7,672 KB
権限があれば一括ダウンロードができます

ソースコード

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())

    if is_kadomatsu(x1, x2, x3):
        return "YES"

    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