結果

問題 No.973 余興
ユーザー convexineqconvexineq
提出日時 2020-01-18 01:04:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 274,280 KB
最終ジャッジ日時 2023-09-08 10:59:05
合計ジャッジ時間 24,964 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 711 ms
274,280 KB
testcase_01 AC 728 ms
273,408 KB
testcase_02 AC 740 ms
273,400 KB
testcase_03 AC 669 ms
273,440 KB
testcase_04 AC 719 ms
274,184 KB
testcase_05 AC 780 ms
274,120 KB
testcase_06 AC 739 ms
273,400 KB
testcase_07 AC 766 ms
273,948 KB
testcase_08 AC 715 ms
273,116 KB
testcase_09 AC 773 ms
273,948 KB
testcase_10 AC 717 ms
266,236 KB
testcase_11 AC 233 ms
147,384 KB
testcase_12 AC 227 ms
147,580 KB
testcase_13 AC 227 ms
147,328 KB
testcase_14 AC 224 ms
147,148 KB
testcase_15 AC 121 ms
84,732 KB
testcase_16 AC 119 ms
84,860 KB
testcase_17 AC 109 ms
81,680 KB
testcase_18 AC 112 ms
83,900 KB
testcase_19 AC 122 ms
83,552 KB
testcase_20 AC 120 ms
81,564 KB
testcase_21 AC 130 ms
84,828 KB
testcase_22 AC 129 ms
84,652 KB
testcase_23 AC 119 ms
83,488 KB
testcase_24 AC 114 ms
82,964 KB
testcase_25 AC 102 ms
79,532 KB
testcase_26 AC 109 ms
81,516 KB
testcase_27 AC 133 ms
86,672 KB
testcase_28 AC 117 ms
83,148 KB
testcase_29 AC 117 ms
83,152 KB
testcase_30 AC 501 ms
273,608 KB
testcase_31 AC 506 ms
273,804 KB
testcase_32 AC 499 ms
273,844 KB
testcase_33 AC 526 ms
273,660 KB
testcase_34 AC 553 ms
272,228 KB
testcase_35 AC 495 ms
273,040 KB
testcase_36 AC 492 ms
267,964 KB
testcase_37 AC 486 ms
268,068 KB
testcase_38 AC 500 ms
272,448 KB
testcase_39 AC 508 ms
272,880 KB
testcase_40 AC 71 ms
71,168 KB
testcase_41 AC 71 ms
71,128 KB
testcase_42 AC 70 ms
71,012 KB
testcase_43 AC 71 ms
71,060 KB
testcase_44 WA -
testcase_45 AC 85 ms
76,112 KB
testcase_46 AC 553 ms
273,580 KB
testcase_47 AC 559 ms
273,348 KB
testcase_48 AC 555 ms
273,776 KB
testcase_49 AC 510 ms
257,552 KB
testcase_50 AC 549 ms
271,992 KB
testcase_51 AC 550 ms
273,656 KB
testcase_52 AC 489 ms
273,516 KB
testcase_53 AC 494 ms
270,152 KB
testcase_54 AC 487 ms
273,412 KB
testcase_55 AC 493 ms
273,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

r = [0]*n #r[i]= iから左にどこまで伸ばせるか
l = [0]*n #l[i]= iから右に...
pt = res = 0
for i in range(n-1):
    res -= a[i] 
    while pt < n and res+a[pt] <= x:
        res += a[pt]
        pt += 1
    r[i] = pt

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

dp = [[0]*n for _ in range(n)]
for i in range(n-1,-1,-1):
    j = i
    while j < n:
        if dp[i][j]:
            j += 1
        else: #0の場合、そこは負けで、上、右に1をのばす
            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]

if dp[0][-1] == 1:
    print("A")
else:
    print("B")
0