結果

問題 No.973 余興
ユーザー neterukunneterukun
提出日時 2020-01-19 16:15:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 822 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 250,268 KB
最終ジャッジ日時 2023-09-15 20:03:48
合計ジャッジ時間 12,567 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 243 ms
249,920 KB
testcase_06 AC 246 ms
250,012 KB
testcase_07 AC 245 ms
249,664 KB
testcase_08 AC 245 ms
249,716 KB
testcase_09 AC 245 ms
249,760 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 136 ms
135,216 KB
testcase_14 WA -
testcase_15 AC 75 ms
71,268 KB
testcase_16 AC 73 ms
71,420 KB
testcase_17 WA -
testcase_18 AC 74 ms
71,312 KB
testcase_19 AC 74 ms
71,412 KB
testcase_20 AC 72 ms
71,172 KB
testcase_21 AC 74 ms
71,124 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 74 ms
71,192 KB
testcase_29 WA -
testcase_30 AC 241 ms
249,952 KB
testcase_31 AC 241 ms
249,748 KB
testcase_32 AC 239 ms
249,856 KB
testcase_33 AC 241 ms
249,724 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 236 ms
249,892 KB
testcase_37 AC 238 ms
249,860 KB
testcase_38 WA -
testcase_39 AC 239 ms
249,828 KB
testcase_40 WA -
testcase_41 AC 72 ms
71,212 KB
testcase_42 AC 72 ms
71,192 KB
testcase_43 AC 72 ms
71,056 KB
testcase_44 WA -
testcase_45 AC 70 ms
71,116 KB
testcase_46 WA -
testcase_47 AC 240 ms
250,072 KB
testcase_48 WA -
testcase_49 AC 239 ms
249,860 KB
testcase_50 WA -
testcase_51 AC 246 ms
249,908 KB
testcase_52 AC 242 ms
249,800 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
a = list(map(int, input().split()))

ruiseki = [0] * (n + 1)
for i in range(n):
    ruiseki[i + 1] = ruiseki[i] + a[i]
    

def solve(l, r):
    # [l, r)のシュークリームが残っているときの先手の勝ち負け
    if r - l == 0:
        dp[l][r] = True
        return True
    if r - l == 1:
        dp[l][r] = False
        return False
    if dp[l][r] is not None:
        return dp[l][r]

    tmp = False
    for newl in range(l + 1, r + 1):
        if ruiseki[newl] - ruiseki[l] <= x:
            tmp |= not solve(newl, r)
    for newr in range(l, r):
        if ruiseki[r] - ruiseki[newr] <= x:
            tmp |= not solve(l, newr)
    dp[l][r] = tmp
    
    return tmp

dp = [[0] * (n + 1) for i in range(n + 1)]
if solve(0, n):
    print("A")
else:
    print("B")
0