結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 839 ms
273,660 KB
testcase_04 WA -
testcase_05 AC 719 ms
273,684 KB
testcase_06 AC 705 ms
273,464 KB
testcase_07 AC 719 ms
273,668 KB
testcase_08 AC 707 ms
273,488 KB
testcase_09 AC 707 ms
273,796 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 178 ms
147,340 KB
testcase_14 WA -
testcase_15 AC 111 ms
85,004 KB
testcase_16 AC 116 ms
84,884 KB
testcase_17 WA -
testcase_18 AC 109 ms
83,176 KB
testcase_19 AC 106 ms
83,244 KB
testcase_20 AC 102 ms
81,528 KB
testcase_21 AC 113 ms
84,624 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 110 ms
83,400 KB
testcase_29 WA -
testcase_30 AC 305 ms
273,820 KB
testcase_31 AC 305 ms
273,628 KB
testcase_32 AC 302 ms
273,688 KB
testcase_33 AC 300 ms
273,688 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 306 ms
268,308 KB
testcase_37 AC 308 ms
268,520 KB
testcase_38 WA -
testcase_39 AC 308 ms
273,200 KB
testcase_40 AC 71 ms
71,340 KB
testcase_41 AC 68 ms
71,388 KB
testcase_42 AC 68 ms
71,312 KB
testcase_43 AC 68 ms
71,312 KB
testcase_44 WA -
testcase_45 AC 78 ms
76,168 KB
testcase_46 WA -
testcase_47 AC 320 ms
273,912 KB
testcase_48 WA -
testcase_49 AC 307 ms
257,672 KB
testcase_50 WA -
testcase_51 AC 323 ms
274,152 KB
testcase_52 AC 324 ms
273,536 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
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 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