結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 604 ms
274,528 KB
testcase_01 AC 617 ms
274,292 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 571 ms
274,104 KB
testcase_05 WA -
testcase_06 AC 564 ms
274,604 KB
testcase_07 AC 577 ms
274,024 KB
testcase_08 AC 580 ms
273,160 KB
testcase_09 WA -
testcase_10 AC 539 ms
266,960 KB
testcase_11 AC 248 ms
147,688 KB
testcase_12 AC 231 ms
147,860 KB
testcase_13 WA -
testcase_14 AC 230 ms
147,160 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 108 ms
83,768 KB
testcase_19 WA -
testcase_20 AC 104 ms
82,020 KB
testcase_21 AC 113 ms
85,036 KB
testcase_22 AC 123 ms
84,960 KB
testcase_23 AC 117 ms
83,576 KB
testcase_24 AC 121 ms
83,908 KB
testcase_25 AC 97 ms
79,776 KB
testcase_26 WA -
testcase_27 AC 127 ms
86,544 KB
testcase_28 AC 115 ms
83,584 KB
testcase_29 AC 112 ms
83,356 KB
testcase_30 AC 579 ms
273,900 KB
testcase_31 AC 574 ms
274,168 KB
testcase_32 AC 560 ms
273,636 KB
testcase_33 AC 590 ms
273,736 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 568 ms
267,888 KB
testcase_37 AC 565 ms
267,876 KB
testcase_38 AC 580 ms
272,912 KB
testcase_39 WA -
testcase_40 AC 69 ms
71,244 KB
testcase_41 AC 69 ms
71,148 KB
testcase_42 AC 67 ms
71,316 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 80 ms
76,216 KB
testcase_46 AC 729 ms
273,572 KB
testcase_47 AC 760 ms
273,596 KB
testcase_48 AC 726 ms
273,720 KB
testcase_49 WA -
testcase_50 AC 721 ms
271,932 KB
testcase_51 AC 733 ms
273,684 KB
testcase_52 WA -
testcase_53 AC 450 ms
270,832 KB
testcase_54 AC 464 ms
274,088 KB
testcase_55 AC 479 ms
273,844 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 j in range(1,n):
    for k in range(l[j],j):
        dp[k][j] = 1

#for i in dp: print(*i)
#print(l,r)
for i in range(n-2,-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)

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

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



0