Submission #71319162


Source Code Expand

import sys
# sys.setrecursionlimit(10 ** 6)

# import numpy as np
# <nonumba> from numba import njit, jit, boolean, int64, float64, typeof




def main():
    from io import StringIO
    execute(StringIO(sample), sys.stderr)
    print("-- ^sample! --", file=sys.stderr)

    execute(sys.stdin, sys.stdout)

    # #<nonumba> if len(solve.nopython_signatures) != 1:
    # #<nonumba>     raise KeyboardInterrupt("!! Unexpected: wrong use of jit !!")

def execute(src, dst):
    T = int(src.readline())
    Ns = []
    Hs = []
    TLUs = []
    for _iq in range(T):
        N, H, = map(int, src.readline().split())
        Ns.append(N) ; Hs.append(H)
        TLUs.append([list(map(int, src.readline().split())) for _i in range(N)])

    ans = solve(T, Ns, Hs, TLUs)

    print(*ans, sep="\n", file=dst)

sample = """\
3
2 5
3 1 4
8 9 11
2 6
1 1 4
3 5 8
10 36
27 37 38
30 34 54
38 20 77
45 1 36
49 38 51
52 31 58
65 43 60
71 14 42
73 36 38
85 14 29
"""

def solve(T, Ns, Hs, TLUs):
    ans = []
    for q in range(T):
        N, H, = Ns[q] , Hs[q]
        TLU = TLUs[q]
        pt = 0
        hr = H
        lr = H
        able = True
        for t, l, u in TLU:
            dr = t - pt
            hr += dr
            lr -= dr
            if hr < l or u < lr :
                able = False
                break
            hr = min(hr , u)
            lr = max(lr , l)
            pt = t
            continue
        if able:
            ans.append("Yes")
        else:
            ans.append("No")
    return ans

main()


Submission Info

Submission Time
Task C - Flapping Takahashi
User tariaki
Language Python (CPython 3.13.7)
Score 300
Code Size 1605 Byte
Status AC
Exec Time 145 ms
Memory 49352 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 29
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 10 ms 9372 KiB
01_small_00.txt AC 145 ms 49352 KiB
01_small_01.txt AC 114 ms 40164 KiB
01_small_02.txt AC 99 ms 37320 KiB
01_small_03.txt AC 91 ms 35648 KiB
01_small_04.txt AC 82 ms 34216 KiB
01_small_05.txt AC 76 ms 32848 KiB
01_small_06.txt AC 72 ms 32424 KiB
01_small_07.txt AC 70 ms 32148 KiB
02_random_00.txt AC 60 ms 27148 KiB
02_random_01.txt AC 63 ms 31892 KiB
02_random_02.txt AC 72 ms 31976 KiB
02_random_03.txt AC 55 ms 29420 KiB
02_random_04.txt AC 71 ms 32100 KiB
02_random_05.txt AC 60 ms 31988 KiB
02_random_06.txt AC 59 ms 27488 KiB
02_random_07.txt AC 62 ms 31892 KiB
02_random_08.txt AC 73 ms 32168 KiB
02_random_09.txt AC 39 ms 21620 KiB
02_random_10.txt AC 72 ms 31976 KiB
02_random_11.txt AC 62 ms 32108 KiB
02_random_12.txt AC 64 ms 31924 KiB
02_random_13.txt AC 64 ms 32100 KiB
02_random_14.txt AC 62 ms 31968 KiB
02_random_15.txt AC 63 ms 32108 KiB
02_random_16.txt AC 63 ms 31924 KiB
02_random_17.txt AC 61 ms 32108 KiB
02_random_18.txt AC 62 ms 32120 KiB
02_random_19.txt AC 63 ms 31976 KiB