結果

問題 No.635 自然門松列
ユーザー convexineq
提出日時 2021-02-26 03:48:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 650 ms
コード長 691 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 59,904 KB
最終ジャッジ日時 2024-10-01 19:29:18
合計ジャッジ時間 2,456 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(x,y,z,a,b,c):
    def is_kadomatsu(a,b,c): return a!=c and (a < b > c or a > b < c) 
    def is_kadomatsu_t(t): return is_kadomatsu(x+a*t,y+b*t,z+c*t)

    if is_kadomatsu_t(0): return 1
    if is_kadomatsu_t(1e8): return 1
    if a != b:
        t = (y-x)/(a-b)
        if t > 0:
            if is_kadomatsu_t(t-1e-8): return 1
            if is_kadomatsu_t(t+1e-8): return 1
    if b != c:
        t = (y-z)/(c-b)
        if t > 0:
            if is_kadomatsu_t(t-1e-8): return 1
            if is_kadomatsu_t(t+1e-8): return 1
    if is_kadomatsu_t(10**9): return 1
    return 0

T = int(input())
for _ in range(T):
    print("YES" if solve(*map(int,input().split())) else "NO")
0