結果

問題 No.635 自然門松列
ユーザー RyutoRyuto
提出日時 2018-03-05 15:54:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 76,100 KB
最終ジャッジ日時 2023-09-29 00:30:45
合計ジャッジ時間 3,866 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
70,992 KB
testcase_01 AC 78 ms
71,288 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 78 ms
71,256 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

def ChkKado(x, y, z):
    if x != y != z != x:
        if x > y < z or x < y > z:
            return True
    return False


def MkRange(d0, dt):
    tmax = float('inf')
    tmin = 0.0

    if dt == 0:
        if d0 <= 0:
            tmax = -1
    elif dt > 0:
        tmin = max(0.0, -d0/dt)
    elif dt < 0:
        tmax = -d0/dt

    return [tmin, tmax]


def ChkAbKado(x0, y0, z0, xt, yt, zt):
    dyx = [y0 - x0, yt - xt]
    dyz = [y0 - z0, yt - zt]
    yxrange = MkRange(*dyx)
    yzrange = MkRange(*dyz)
    if yxrange[1] < 0 or yzrange[1] < 0:
        return False
    elif max(yxrange[0], yzrange[0]) < min(yxrange[1], yzrange[1]):
        return True
    elif min(yxrange[0], yzrange[0]) > max(yxrange[1], yzrange[1]):
        return True
    else:
        return False


N = int(input())
tcases = []
for i in range(N):
    tcases.append([int(x) for x in input().split()])

for tcase in tcases:
    if ChkKado(*tcase[:3]):
        print('YES')
    elif ChkAbKado(*tcase):
        print('YES')
    else:
        print('NO')
0