結果

問題 No.635 自然門松列
ユーザー rlangevinrlangevin
提出日時 2023-10-16 22:46:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,725 bytes
コンパイル時間 3,782 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 53,588 KB
最終ジャッジ日時 2023-10-16 22:50:42
合計ジャッジ時間 15,131 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
53,588 KB
testcase_01 AC 72 ms
53,588 KB
testcase_02 AC 49 ms
53,588 KB
testcase_03 AC 42 ms
53,588 KB
testcase_04 AC 37 ms
53,588 KB
testcase_05 AC 48 ms
53,588 KB
testcase_06 AC 48 ms
53,588 KB
testcase_07 AC 78 ms
53,588 KB
testcase_08 AC 71 ms
53,588 KB
testcase_09 AC 73 ms
53,588 KB
testcase_10 WA -
testcase_11 AC 77 ms
53,588 KB
testcase_12 AC 76 ms
53,588 KB
testcase_13 AC 77 ms
53,588 KB
testcase_14 AC 37 ms
53,588 KB
testcase_15 AC 79 ms
53,588 KB
testcase_16 AC 85 ms
53,588 KB
testcase_17 AC 37 ms
53,588 KB
testcase_18 AC 36 ms
53,588 KB
testcase_19 AC 37 ms
53,588 KB
testcase_20 AC 37 ms
53,588 KB
testcase_21 AC 37 ms
53,588 KB
testcase_22 AC 40 ms
53,588 KB
testcase_23 AC 39 ms
53,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
def check(x1, x2, y1, y2):
    return x1 == x2 and y1 == y2

def kadomatsu(a, b, c):
    if a == b or b == c or c == a:
        return False
    if a < b < c or a > b > c:
        return False
    return True

for _ in range(N):
    x1, x2, x3, y1, y2, y3 = map(int, input().split())
    if check(x1, x2, y1, y2) or check(x1, x3, y1, y3) or check(x3, x2, y3, y2):
        print("NO")
        continue
    if kadomatsu(x1, x2, x3) or kadomatsu(y1, y2, y3):
        print("YES")
        continue
    if x1 == x3:
        print("YES")
        continue
    if y2 > max(y1, y3) or y2 < min(y1, y3):
        print("YES")
        continue
    if x1 == x2:
        x1, x3 = x3, x1
        y1, y3 = y3, y1
    if x2 == x3:
        if x1 < x2:
            if y2 > y3:
                print("YES")
            else:
                print("NO")
        else:
            if y2 < y3:
                print("YES")
            else:
                print("NO")
    else:
        if x1 > x2 > x3:
            x1, x3 = x3, x1
            y1, y3 = y3, y1    
        if y2 == y3:
            if y1 <= y2:
                print("NO")
            else:
                print("YES")
        elif y1 == y2:
            if y3 >= y2:
                print("NO")
            else:
                print("YES")
        else:
            if y1 <= y2 <= y3:
                print("NO")
            else:
                if (y3 - y2) * x1 + (x2 - x3) * y1 < x2 * (y3 - y2) + (x2 - x3) * y2:
                    print("YES")
                elif (y2 - y1) * x3 + (x1 - x2) * y3 > x2 * (y2 - y1) + (x1 - x2) * y2:
                    print("YES")
                else:
                    print("NO")
0