結果

問題 No.973 余興
ユーザー convexineqconvexineq
提出日時 2020-01-17 23:23:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 275,596 KB
最終ジャッジ日時 2023-09-08 07:41:07
合計ジャッジ時間 21,692 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 952 ms
273,904 KB
testcase_04 WA -
testcase_05 AC 758 ms
274,208 KB
testcase_06 AC 768 ms
273,864 KB
testcase_07 AC 734 ms
274,100 KB
testcase_08 AC 778 ms
273,676 KB
testcase_09 AC 725 ms
274,024 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 175 ms
147,408 KB
testcase_14 WA -
testcase_15 AC 110 ms
84,720 KB
testcase_16 AC 109 ms
85,240 KB
testcase_17 WA -
testcase_18 AC 107 ms
83,672 KB
testcase_19 AC 108 ms
83,708 KB
testcase_20 AC 104 ms
81,976 KB
testcase_21 AC 112 ms
85,060 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 105 ms
83,472 KB
testcase_29 WA -
testcase_30 AC 293 ms
273,920 KB
testcase_31 AC 282 ms
273,904 KB
testcase_32 AC 285 ms
273,928 KB
testcase_33 AC 283 ms
273,752 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 286 ms
267,768 KB
testcase_37 AC 283 ms
268,488 KB
testcase_38 WA -
testcase_39 AC 305 ms
273,484 KB
testcase_40 AC 65 ms
71,552 KB
testcase_41 AC 66 ms
71,192 KB
testcase_42 AC 70 ms
71,100 KB
testcase_43 AC 70 ms
71,512 KB
testcase_44 WA -
testcase_45 AC 81 ms
76,592 KB
testcase_46 WA -
testcase_47 AC 326 ms
273,940 KB
testcase_48 WA -
testcase_49 AC 298 ms
257,792 KB
testcase_50 WA -
testcase_51 AC 316 ms
273,876 KB
testcase_52 AC 318 ms
273,780 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
権限があれば一括ダウンロードができます

ソースコード

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-1
pt = 0
res = -a[0]
for i in range(n-1):
    while pt < n and res+a[pt] <= n:
        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] <= n:
        res += a[pt]
        pt -= 1
    l[i] = pt+1
    res -= a[i-1]


dp = [[0]*n for _ in range(n)]
for i in range(n):
    dp[i][i] = -1


#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)


a = dp[0][-1]

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



0