結果
| 問題 | No.635 自然門松列 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-11-09 08:59:52 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 66 ms / 650 ms | 
| コード長 | 1,210 bytes | 
| コンパイル時間 | 196 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 73,088 KB | 
| 最終ジャッジ日時 | 2024-09-26 00:03:20 | 
| 合計ジャッジ時間 | 2,358 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 23 | 
ソースコード
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()
            
            
            
        