結果

問題 No.2015 Stair Counter
ユーザー mkawa2mkawa2
提出日時 2022-07-22 21:33:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 1,091 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 107,260 KB
最終ジャッジ日時 2023-09-17 09:02:25
合計ジャッジ時間 4,687 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,472 KB
testcase_01 AC 126 ms
78,132 KB
testcase_02 AC 131 ms
78,276 KB
testcase_03 AC 129 ms
78,692 KB
testcase_04 AC 124 ms
78,116 KB
testcase_05 AC 123 ms
77,540 KB
testcase_06 AC 130 ms
78,192 KB
testcase_07 AC 131 ms
78,656 KB
testcase_08 AC 131 ms
78,500 KB
testcase_09 AC 91 ms
76,664 KB
testcase_10 AC 93 ms
76,656 KB
testcase_11 AC 91 ms
76,580 KB
testcase_12 AC 88 ms
77,304 KB
testcase_13 AC 92 ms
78,036 KB
testcase_14 AC 90 ms
77,556 KB
testcase_15 AC 103 ms
94,576 KB
testcase_16 AC 114 ms
103,936 KB
testcase_17 AC 105 ms
98,444 KB
testcase_18 AC 105 ms
97,716 KB
testcase_19 AC 117 ms
107,260 KB
testcase_20 AC 109 ms
105,320 KB
testcase_21 AC 127 ms
78,224 KB
testcase_22 AC 126 ms
78,392 KB
testcase_23 AC 129 ms
78,440 KB
testcase_24 AC 126 ms
78,364 KB
testcase_25 AC 124 ms
78,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

def solve():
    n, m = LI()
    aa = [m]+LI()
    for i in range(1, n+1):
        cur = aa[i]
        if i-2 >= 0:
            if aa[i-2] > cur:
                return False
            cur -= aa[i-2]
        if cur > aa[i-1]:
            return False
        aa[i-1] -= cur
    return aa[-2]+aa[-1] == m

for _ in range(II()):
    print("Yes" if solve() else "No")
0