結果

問題 No.973 余興
ユーザー neterukunneterukun
提出日時 2020-01-19 16:16:09
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 825 bytes
コンパイル時間 1,730 ms
コンパイル使用メモリ 86,612 KB
実行使用メモリ 282,148 KB
最終ジャッジ日時 2023-09-15 20:12:01
合計ジャッジ時間 44,670 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 2,479 ms
105,564 KB
testcase_16 AC 1,182 ms
91,176 KB
testcase_17 AC 650 ms
86,540 KB
testcase_18 AC 877 ms
88,160 KB
testcase_19 AC 1,995 ms
94,000 KB
testcase_20 AC 626 ms
85,308 KB
testcase_21 AC 1,154 ms
90,592 KB
testcase_22 AC 1,156 ms
90,608 KB
testcase_23 AC 887 ms
88,136 KB
testcase_24 AC 735 ms
88,260 KB
testcase_25 AC 739 ms
85,032 KB
testcase_26 AC 623 ms
85,476 KB
testcase_27 AC 3,602 ms
113,812 KB
testcase_28 AC 1,934 ms
98,052 KB
testcase_29 AC 855 ms
88,480 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 AC 69 ms
70,996 KB
testcase_41 AC 72 ms
71,180 KB
testcase_42 AC 73 ms
71,020 KB
testcase_43 AC 70 ms
71,268 KB
testcase_44 AC 70 ms
71,020 KB
testcase_45 AC 112 ms
78,544 KB
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
権限があれば一括ダウンロードができます

ソースコード

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 = [[None] * (n + 1) for i in range(n + 1)]
if solve(0, n):
    print("A")
else:
    print("B")
0