結果

問題 No.635 自然門松列
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-09 08:59:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 650 ms
コード長 1,210 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 72,576 KB
最終ジャッジ日時 2023-11-09 08:59:56
合計ジャッジ時間 2,979 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,736 KB
testcase_01 AC 45 ms
55,736 KB
testcase_02 AC 46 ms
57,832 KB
testcase_03 AC 51 ms
63,616 KB
testcase_04 AC 47 ms
57,832 KB
testcase_05 AC 89 ms
72,576 KB
testcase_06 AC 70 ms
72,576 KB
testcase_07 AC 69 ms
72,572 KB
testcase_08 AC 47 ms
57,832 KB
testcase_09 AC 56 ms
57,832 KB
testcase_10 AC 62 ms
68,180 KB
testcase_11 AC 57 ms
65,852 KB
testcase_12 AC 70 ms
72,572 KB
testcase_13 AC 69 ms
72,572 KB
testcase_14 AC 69 ms
72,568 KB
testcase_15 AC 46 ms
55,736 KB
testcase_16 AC 46 ms
55,736 KB
testcase_17 AC 65 ms
70,504 KB
testcase_18 AC 64 ms
70,504 KB
testcase_19 AC 65 ms
70,500 KB
testcase_20 AC 64 ms
70,500 KB
testcase_21 AC 71 ms
70,360 KB
testcase_22 AC 65 ms
70,504 KB
testcase_23 AC 64 ms
70,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
eps = 0.00000001

def answer():
    
    x1,x2,x3,y1,y2,y3 = map(int,input().split())
    
    X = [x1,x2,x3]
    Y = [y1,y2,y3]
    
    def eq(i,j):
        
        if Y[i]==Y[j]:
            
            if X[i]!=X[j]:
                return -1
            else:
                return 0
        return (X[i]-X[j])/(Y[j]-Y[i])
    
    def check(t):
        if t<0:
            return False
        Z = [X[i]+Y[i]*t for i in range(3)]
        if len(set(Z))!=3:
            return False
        
        if (min(Z)==Z[1])|(max(Z)==Z[1]):

            return True

        return False
        
    if check(0):
        print('YES')
        return
    
    for i in range(3):
        for j in range(3):
            
            t = eq(i,j)

            if t<0:
                continue
            if t==0:
                if check(eps):
                    print('YES')
                    return
            if (check(t+eps)|check(t-eps)):
                print('YES')
                return
    print('NO')
    return
for _ in range(N):
    answer()
0