結果

問題 No.2015 Stair Counter
ユーザー asumo0729asumo0729
提出日時 2022-07-22 21:31:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 1,126 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 106,860 KB
最終ジャッジ日時 2023-09-17 08:58:54
合計ジャッジ時間 6,529 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
72,512 KB
testcase_01 AC 149 ms
78,932 KB
testcase_02 AC 150 ms
79,008 KB
testcase_03 AC 153 ms
78,632 KB
testcase_04 AC 147 ms
78,768 KB
testcase_05 AC 148 ms
78,860 KB
testcase_06 AC 158 ms
78,792 KB
testcase_07 AC 155 ms
78,852 KB
testcase_08 AC 156 ms
78,812 KB
testcase_09 AC 137 ms
78,436 KB
testcase_10 AC 136 ms
78,156 KB
testcase_11 AC 138 ms
78,396 KB
testcase_12 AC 138 ms
79,656 KB
testcase_13 AC 140 ms
79,864 KB
testcase_14 AC 141 ms
79,964 KB
testcase_15 AC 150 ms
95,952 KB
testcase_16 AC 166 ms
103,708 KB
testcase_17 AC 153 ms
100,368 KB
testcase_18 AC 156 ms
99,056 KB
testcase_19 AC 171 ms
101,336 KB
testcase_20 AC 162 ms
106,860 KB
testcase_21 AC 151 ms
78,804 KB
testcase_22 AC 156 ms
78,828 KB
testcase_23 AC 158 ms
78,788 KB
testcase_24 AC 150 ms
78,772 KB
testcase_25 AC 152 ms
78,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
from collections import defaultdict, deque
import heapq
from heapq import heapify, heappop, _heapify_max, heappush
from bisect import bisect_left, bisect_right
import math
import itertools
import copy

stdin=sys.stdin
#sys.setrecursionlimit(10 ** 7)
## import pypyjit
## pypyjit.set_param('max_unroll_recursion=-1')

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
inf = 1 << 60
inf = float('inf')
mod = 10 ** 9 + 7
mod = 998244353
eps = 1e-9
sortkey1 = itemgetter(0)
sortkey2 = lambda x: (x[0], x[1])



###############################################################

T = ip()
for _ in range(T):
    N, M = lp()
    A = lp()
    steps = [0 for _ in range(N + 1)]
    bef = M
    ans = 'Yes'
    for i in range(N):
        a = A[i]
        if steps[i] > a:
            ans = 'No'
        pl = a - steps[i]
        if pl > bef:
            ans = 'No'
        steps[i + 1] = bef - pl
        bef = a
    if steps[-1] != 0:
        ans = 'No'
    print(ans)
0