Submission #71423833


Source Code Expand

"""
<方針>
- 数字が馬鹿でかいところはループとかを回すわけにはいかない。
- 移動できるレンジが目標と被ってるところがあるかを毎回試してけばいけんじゃね?
"""
T = int(input())

for _ in range(T):
  N, H = map(int, input().split())
  T = 0 # 現在時刻
  L = H # 現在最低高度
  U = H # 現在最高高度
  
  ok = True # 可能フラグ
  
  # 試してみる
  for _ in range(N):
    t, l, u = map(int, input().split())
    dt = t - T # 時間変化
    T = t # 現在時刻更新
    L = max(L - dt, l) # 現在最低高度更新
    U = min(U + dt, u) # 現在最低高度更新
    
    # 高度が矛盾したら
    if not (L<=U):
      ok = False
  
  # 出力
  if(ok):
    print("Yes")
  else:
    print("No")

Submission Info

Submission Time
Task C - Flapping Takahashi
User mattsunkun
Language Python (PyPy 3.11-v7.3.20)
Score 300
Code Size 822 Byte
Status AC
Exec Time 388 ms
Memory 110788 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 53 ms 79780 KiB
01_small_00.txt AC 388 ms 110788 KiB
01_small_01.txt AC 283 ms 109312 KiB
01_small_02.txt AC 252 ms 109376 KiB
01_small_03.txt AC 240 ms 109444 KiB
01_small_04.txt AC 219 ms 109840 KiB
01_small_05.txt AC 205 ms 109456 KiB
01_small_06.txt AC 197 ms 109324 KiB
01_small_07.txt AC 195 ms 109324 KiB
02_random_00.txt AC 150 ms 109108 KiB
02_random_01.txt AC 168 ms 108856 KiB
02_random_02.txt AC 169 ms 108792 KiB
02_random_03.txt AC 155 ms 108784 KiB
02_random_04.txt AC 167 ms 109104 KiB
02_random_05.txt AC 166 ms 108952 KiB
02_random_06.txt AC 150 ms 108816 KiB
02_random_07.txt AC 167 ms 108796 KiB
02_random_08.txt AC 166 ms 109108 KiB
02_random_09.txt AC 128 ms 109108 KiB
02_random_10.txt AC 167 ms 108780 KiB
02_random_11.txt AC 167 ms 108832 KiB
02_random_12.txt AC 179 ms 109132 KiB
02_random_13.txt AC 178 ms 109328 KiB
02_random_14.txt AC 177 ms 109248 KiB
02_random_15.txt AC 177 ms 109344 KiB
02_random_16.txt AC 177 ms 109340 KiB
02_random_17.txt AC 167 ms 108796 KiB
02_random_18.txt AC 167 ms 108784 KiB
02_random_19.txt AC 171 ms 108984 KiB