結果

問題 No.973 余興
ユーザー chinchillachinchilla
提出日時 2020-01-31 02:13:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,415 ms / 4,000 ms
コード長 367 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2023-10-14 11:36:38
合計ジャッジ時間 22,350 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,415 ms
8,660 KB
testcase_01 AC 1,343 ms
8,668 KB
testcase_02 AC 1,387 ms
8,632 KB
testcase_03 AC 1,370 ms
8,676 KB
testcase_04 AC 1,390 ms
8,620 KB
testcase_05 AC 1,365 ms
8,688 KB
testcase_06 AC 1,356 ms
8,652 KB
testcase_07 AC 1,348 ms
8,692 KB
testcase_08 AC 1,377 ms
8,652 KB
testcase_09 AC 1,383 ms
8,804 KB
testcase_10 AC 1,307 ms
8,700 KB
testcase_11 AC 22 ms
8,428 KB
testcase_12 AC 23 ms
8,556 KB
testcase_13 AC 21 ms
8,512 KB
testcase_14 AC 22 ms
8,428 KB
testcase_15 AC 75 ms
8,200 KB
testcase_16 AC 70 ms
8,192 KB
testcase_17 AC 48 ms
8,180 KB
testcase_18 AC 58 ms
8,244 KB
testcase_19 AC 59 ms
8,200 KB
testcase_20 AC 48 ms
7,752 KB
testcase_21 AC 68 ms
7,824 KB
testcase_22 AC 69 ms
8,204 KB
testcase_23 AC 57 ms
7,832 KB
testcase_24 AC 60 ms
8,128 KB
testcase_25 AC 35 ms
7,812 KB
testcase_26 AC 48 ms
8,240 KB
testcase_27 AC 78 ms
8,192 KB
testcase_28 AC 63 ms
7,764 KB
testcase_29 AC 57 ms
7,824 KB
testcase_30 AC 23 ms
8,720 KB
testcase_31 AC 22 ms
8,636 KB
testcase_32 AC 22 ms
8,608 KB
testcase_33 AC 23 ms
8,640 KB
testcase_34 AC 26 ms
8,680 KB
testcase_35 AC 27 ms
8,604 KB
testcase_36 AC 29 ms
8,636 KB
testcase_37 AC 27 ms
8,664 KB
testcase_38 AC 29 ms
8,676 KB
testcase_39 AC 28 ms
8,724 KB
testcase_40 AC 14 ms
7,748 KB
testcase_41 AC 14 ms
7,888 KB
testcase_42 AC 14 ms
7,744 KB
testcase_43 AC 14 ms
7,832 KB
testcase_44 AC 14 ms
7,728 KB
testcase_45 AC 15 ms
7,848 KB
testcase_46 AC 82 ms
8,708 KB
testcase_47 AC 84 ms
8,640 KB
testcase_48 AC 90 ms
8,832 KB
testcase_49 AC 86 ms
8,760 KB
testcase_50 AC 88 ms
8,712 KB
testcase_51 AC 88 ms
8,680 KB
testcase_52 AC 83 ms
8,588 KB
testcase_53 AC 89 ms
8,644 KB
testcase_54 AC 88 ms
8,636 KB
testcase_55 AC 94 ms
8,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
a = list(map(int, input().split())) + [x+1]
f, b = [0] * (n+1), [0] * (n+1)
i, j, s = -1, -1, 0
while i < n:
	if s > x:
		f[i] = j
		i += 1
		s -= a[i]
	else:
		j += 1
		s += a[j]
		b[j] = i
f[n-1] = 0
for j in range(n):
	i = b[j]
	while i >= 0:
		if f[i] <= j:
			f[i] = f[j]
			i = b[i]
		else:
			i -= 1
print("A" if f[0] else "B")
0