結果

問題 No.973 余興
ユーザー convexineqconvexineq
提出日時 2020-01-17 23:54:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,081 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 274,356 KB
最終ジャッジ日時 2023-09-08 08:53:07
合計ジャッジ時間 22,240 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 599 ms
274,108 KB
testcase_01 AC 629 ms
273,972 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 587 ms
273,920 KB
testcase_05 WA -
testcase_06 AC 587 ms
273,836 KB
testcase_07 AC 561 ms
273,784 KB
testcase_08 AC 594 ms
272,808 KB
testcase_09 WA -
testcase_10 AC 568 ms
266,184 KB
testcase_11 AC 217 ms
147,860 KB
testcase_12 AC 204 ms
147,824 KB
testcase_13 WA -
testcase_14 AC 203 ms
147,204 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 120 ms
83,696 KB
testcase_19 WA -
testcase_20 AC 114 ms
82,080 KB
testcase_21 AC 117 ms
85,060 KB
testcase_22 AC 124 ms
85,148 KB
testcase_23 AC 123 ms
83,516 KB
testcase_24 AC 121 ms
83,728 KB
testcase_25 AC 104 ms
79,732 KB
testcase_26 WA -
testcase_27 AC 130 ms
86,704 KB
testcase_28 AC 115 ms
83,676 KB
testcase_29 AC 117 ms
83,576 KB
testcase_30 AC 460 ms
273,696 KB
testcase_31 AC 459 ms
273,852 KB
testcase_32 AC 463 ms
273,736 KB
testcase_33 AC 465 ms
273,624 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 438 ms
268,072 KB
testcase_37 AC 448 ms
267,872 KB
testcase_38 AC 453 ms
272,652 KB
testcase_39 WA -
testcase_40 AC 73 ms
71,220 KB
testcase_41 AC 75 ms
71,284 KB
testcase_42 AC 74 ms
71,308 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 84 ms
76,788 KB
testcase_46 AC 550 ms
273,544 KB
testcase_47 AC 565 ms
273,668 KB
testcase_48 AC 542 ms
274,044 KB
testcase_49 WA -
testcase_50 AC 547 ms
272,536 KB
testcase_51 AC 541 ms
273,520 KB
testcase_52 WA -
testcase_53 AC 422 ms
270,660 KB
testcase_54 AC 414 ms
273,456 KB
testcase_55 AC 433 ms
273,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m,*d= [int(i) for i in read().split()]
#a,t,k = [int(i) for i in readline().split()]

n,x,*a = [int(i) for i in read().split()]

r = [0]*n
l = [0]*n
r[-1] = n
pt = 0
res = -a[0]
for i in range(n-1):
    while pt < n and res+a[pt] <= x:
        res += a[pt]
        pt += 1
    r[i] = pt
    res -= a[i]

pt = n-1
res = -a[n-1]
for i in range(n-1,0,-1):
    while pt >= 0 and res+a[pt] <= x:
        res += a[pt]
        pt -= 1
    l[i] = pt+1
    res -= a[i-1]


dp = [[0]*n for _ in range(n)]

#for i in dp: print(*i)

#for i in dp: print(*i)
#print(l,r)
for i in range(n-1,-1,-1):
    j = i
    while j < n:
        if dp[i][j] == 0:
            dp[i][j] = -1
            for k in range(l[i],i):
                dp[k][j] = 1
            dp[i][j+1:r[j]] = [1]*(r[j]-(j+1))
            j = r[j]
        else:
            j += 1
    #print(dp)

#print(l,r)
#for i in dp: print(*i)
    
a = dp[0][-1]

if a == 1:
    print("A")
else:
    print("B")



0