提出 #71315638


ソースコード 拡げる

import sys
import math
import itertools
from bisect import bisect_left, bisect_right, insort_left
from collections import deque, defaultdict
from heapq import heapify, heappush, heappop #最小値の選定の計算量O(logN)
from functools import lru_cache
from atcoder import modint, _math
from atcoder.string import z_algorithm
from atcoder.segtree import SegTree
from atcoder.lazysegtree import LazySegTree

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 998244353
#Asopy = [a[:] for a in A]
#after = sorted(before, key=lambda x: x[1])

# int input
ii = lambda: int(input())
# map int input
mii = lambda: map(int, input().split())
# list map int input
lmii = lambda: list(mii())
# list int input
lii = lambda x: [ii() for _ in range(x)]
# list list int input
llii = lambda x: [lmii() for _ in range(x)]

# string input
si = lambda: input()
# map string input
msi = lambda: map(str, input().split())
# map string input
lmsi = lambda: list(msi())
# list string input
lsi = lambda x: [si() for _ in range(x)]
# list list string input
llsi = lambda x: [lmsi() for _ in range(x)]
# list string atoi input
lsai = lambda : list(map(lambda c: ord(c)-ord('a'), input()))

def pyn(ans):
	if ans:
		print("Yes")
	else:
		print("No")
def pisINF(ans):
	if ans in [INF, -INF]:
		print(-1)
	else:
		print(ans)

#A
'''W, B = mii()

ans = W*1000//B+1
print(ans)'''

#B
'''N, M = mii()
AB = llii(N)

s = [[0, 0] for _ in range(M)]
for a, b in AB:
	s[a-1][0] += b
	s[a-1][1] += 1
ans = []
for su, cn in s:
	ans.append(su/cn)
print(*ans, sep="\n")'''

#C
def f(N, H, tlu):
	tlu = [[0, H, H]]+tlu
	hrange = [H, H]
	for i in range(N):
		n = tlu[i+1]
		dt = n[0]-tlu[i][0]
		hrange = [max(hrange[0]-dt, n[1]), min(hrange[1]+dt, n[2])]
		if hrange[0]>hrange[1]:
			return "No"
	return "Yes"
		
ans = []
T = ii()
for _ in range(T):
	N, H = mii()
	tlu = llii(N)
	ans.append(f(N, H, tlu))
print(*ans, sep="\n")

#D


#E


#F




提出情報

提出日時
問題 C - Flapping Takahashi
ユーザ TMuuu
言語 Python (PyPy 3.11-v7.3.20)
得点 300
コード長 2009 Byte
結果 AC
実行時間 381 ms
メモリ 123836 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 125 ms 112328 KiB
01_small_00.txt AC 381 ms 121056 KiB
01_small_01.txt AC 337 ms 118032 KiB
01_small_02.txt AC 315 ms 117000 KiB
01_small_03.txt AC 295 ms 115680 KiB
01_small_04.txt AC 276 ms 114892 KiB
01_small_05.txt AC 266 ms 114508 KiB
01_small_06.txt AC 253 ms 114584 KiB
01_small_07.txt AC 242 ms 114100 KiB
02_random_00.txt AC 212 ms 121628 KiB
02_random_01.txt AC 229 ms 123568 KiB
02_random_02.txt AC 234 ms 123820 KiB
02_random_03.txt AC 218 ms 121476 KiB
02_random_04.txt AC 237 ms 123616 KiB
02_random_05.txt AC 225 ms 123788 KiB
02_random_06.txt AC 210 ms 121728 KiB
02_random_07.txt AC 225 ms 123452 KiB
02_random_08.txt AC 230 ms 123500 KiB
02_random_09.txt AC 184 ms 117492 KiB
02_random_10.txt AC 227 ms 123528 KiB
02_random_11.txt AC 225 ms 123624 KiB
02_random_12.txt AC 226 ms 123648 KiB
02_random_13.txt AC 225 ms 123836 KiB
02_random_14.txt AC 224 ms 123668 KiB
02_random_15.txt AC 227 ms 123608 KiB
02_random_16.txt AC 228 ms 123528 KiB
02_random_17.txt AC 223 ms 123780 KiB
02_random_18.txt AC 223 ms 123464 KiB
02_random_19.txt AC 226 ms 123572 KiB