結果

問題 No.973 余興
ユーザー mkawa2mkawa2
提出日時 2020-01-17 23:31:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,249 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 88,868 KB
最終ジャッジ日時 2023-09-08 07:59:42
合計ジャッジ時間 62,593 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
83,128 KB
testcase_01 WA -
testcase_02 AC 131 ms
82,956 KB
testcase_03 AC 131 ms
82,756 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 135 ms
83,008 KB
testcase_07 WA -
testcase_08 AC 127 ms
82,672 KB
testcase_09 AC 131 ms
84,772 KB
testcase_10 AC 136 ms
83,912 KB
testcase_11 WA -
testcase_12 AC 718 ms
83,292 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 76 ms
71,916 KB
testcase_16 AC 76 ms
71,820 KB
testcase_17 AC 77 ms
71,844 KB
testcase_18 AC 75 ms
71,572 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 77 ms
71,688 KB
testcase_22 WA -
testcase_23 AC 75 ms
71,844 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 81 ms
76,892 KB
testcase_28 AC 77 ms
71,880 KB
testcase_29 WA -
testcase_30 AC 2,364 ms
87,896 KB
testcase_31 AC 2,341 ms
86,788 KB
testcase_32 AC 2,356 ms
87,120 KB
testcase_33 AC 2,356 ms
87,036 KB
testcase_34 AC 2,377 ms
87,904 KB
testcase_35 WA -
testcase_36 AC 2,378 ms
87,244 KB
testcase_37 AC 2,332 ms
86,740 KB
testcase_38 AC 2,345 ms
88,868 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 72 ms
71,264 KB
testcase_42 AC 72 ms
71,148 KB
testcase_43 AC 72 ms
71,032 KB
testcase_44 AC 72 ms
71,124 KB
testcase_45 AC 73 ms
71,168 KB
testcase_46 TLE -
testcase_47 TLE -
testcase_48 TLE -
testcase_49 AC 3,885 ms
87,092 KB
testcase_50 TLE -
testcase_51 TLE -
testcase_52 WA -
testcase_53 AC 1,274 ms
86,936 KB
testcase_54 WA -
testcase_55 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    def win(l,r):
        if (l,r) in dp:return dp[l,r]
        if l+1==r:return False
        if l==r:return True
        res=False
        for nl in range(l+1,min(r,lto[l])):
            if not win(nl,r):
                res=True
                break
        for nr in range(r-1,max(l,rto[r]),-1):
            if res:break
            if win(l,nr)==0:
                res=1
                break
        dp[l,r]=res
        return res

    n,x=MI()
    aa=LI()

    lto=[-1]*n
    r=-1
    s=0
    for l in range(n):
        while r<n and s<=x:
            r+=1
            if r>=n:break
            s+=aa[r]
        lto[l]=r
        s-=aa[l]

    rto=[-1]*(n+1)
    l=n
    s=0
    for r in range(n,-1,-1):
        while l>=0 and s<=x:
            l-=1
            if l<0:break
            s+=aa[l]
        rto[r]=l
        s-=aa[r-1]

    dp={}
    if win(0,n):print("A")
    else:print("B")

main()
0