結果

問題 No.635 自然門松列
コンテスト
ユーザー convexineq
提出日時 2021-02-26 03:48:04
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 75 ms / 650 ms
+ 581µs
コード長 691 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 253 ms
コンパイル使用メモリ 95,848 KB
実行使用メモリ 83,200 KB
最終ジャッジ日時 2026-07-17 03:07:03
合計ジャッジ時間 3,435 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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