提出 #71310280


ソースコード 拡げる

def solve():
    N, H = map(int, input().split())
    targets = [list(map(int, input().split())) for _ in range(N)]

    h_range = [H, H]
    t_now = 0

    for time, low, up in targets:
        tdiff = time - t_now
        bottom = max(0, h_range[0] - tdiff)
        top = h_range[1] + tdiff
        if (bottom > up) or (top < low):
            print("No")
            return
        nbottom = max(low, bottom)
        ntop = min(up, top)
        t_now = time
        h_range = [nbottom, ntop]
    
    print('Yes')

def main():
    T = int(input())
    for _ in range(T):
        solve()

main()

提出情報

提出日時
問題 C - Flapping Takahashi
ユーザ scrblbug
言語 Python (PyPy 3.11-v7.3.20)
得点 300
コード長 625 Byte
結果 AC
実行時間 388 ms
メモリ 118096 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 29
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 47 ms 79920 KiB
01_small_00.txt AC 388 ms 110356 KiB
01_small_01.txt AC 294 ms 110584 KiB
01_small_02.txt AC 278 ms 110472 KiB
01_small_03.txt AC 247 ms 110308 KiB
01_small_04.txt AC 224 ms 110460 KiB
01_small_05.txt AC 213 ms 109872 KiB
01_small_06.txt AC 195 ms 109652 KiB
01_small_07.txt AC 172 ms 109188 KiB
02_random_00.txt AC 146 ms 115828 KiB
02_random_01.txt AC 165 ms 117812 KiB
02_random_02.txt AC 162 ms 117876 KiB
02_random_03.txt AC 151 ms 117764 KiB
02_random_04.txt AC 167 ms 118056 KiB
02_random_05.txt AC 158 ms 117708 KiB
02_random_06.txt AC 148 ms 115772 KiB
02_random_07.txt AC 157 ms 117660 KiB
02_random_08.txt AC 163 ms 118056 KiB
02_random_09.txt AC 124 ms 113700 KiB
02_random_10.txt AC 166 ms 117980 KiB
02_random_11.txt AC 161 ms 117880 KiB
02_random_12.txt AC 163 ms 117944 KiB
02_random_13.txt AC 160 ms 118072 KiB
02_random_14.txt AC 160 ms 118096 KiB
02_random_15.txt AC 163 ms 117968 KiB
02_random_16.txt AC 159 ms 117940 KiB
02_random_17.txt AC 159 ms 117720 KiB
02_random_18.txt AC 158 ms 117896 KiB
02_random_19.txt AC 158 ms 117948 KiB