結果

問題 No.635 自然門松列
ユーザー RyutoRyuto
提出日時 2018-03-05 16:05:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,311 bytes
コンパイル時間 1,889 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 75,992 KB
最終ジャッジ日時 2023-09-29 01:31:17
合計ジャッジ時間 3,732 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,236 KB
testcase_01 AC 75 ms
71,224 KB
testcase_02 AC 75 ms
71,196 KB
testcase_03 WA -
testcase_04 AC 76 ms
71,384 KB
testcase_05 AC 86 ms
75,572 KB
testcase_06 AC 83 ms
75,992 KB
testcase_07 AC 84 ms
75,868 KB
testcase_08 AC 75 ms
71,344 KB
testcase_09 AC 75 ms
71,348 KB
testcase_10 WA -
testcase_11 AC 83 ms
75,412 KB
testcase_12 AC 82 ms
75,568 KB
testcase_13 AC 83 ms
75,716 KB
testcase_14 AC 82 ms
75,876 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 81 ms
75,696 KB
testcase_18 AC 82 ms
75,744 KB
testcase_19 AC 82 ms
75,716 KB
testcase_20 AC 83 ms
75,788 KB
testcase_21 AC 83 ms
75,728 KB
testcase_22 AC 82 ms
75,576 KB
testcase_23 AC 82 ms
75,764 KB
権限があれば一括ダウンロードができます

ソースコード

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 MkRange1(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 MkRange2(d0, dt):
    tmax = float('inf')
    tmin = 0.0

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

    return [tmin, tmax]


def ChkAbKado(x0, y0, z0, xt, yt, zt):
    dyx = [y0 - x0, yt - xt]
    dyz = [y0 - z0, yt - zt]
    yxrange1 = MkRange1(*dyx)
    yzrange1 = MkRange1(*dyz)
    yxrange2 = MkRange2(*dyx)
    yzrange2 = MkRange2(*dyz)
    if max(yxrange1[0], yzrange1[0], 0.0) < min(yxrange1[1], yzrange1[1]):
        return True
    elif max(yxrange2[0], yzrange2[0], 0.0) < min(yxrange2[1], yzrange2[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