結果

問題 No.672 最長AB列
ユーザー 👑 H20H20
提出日時 2020-11-05 11:58:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 281 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 97,716 KB
最終ジャッジ日時 2023-09-29 16:51:02
合計ジャッジ時間 4,597 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,528 KB
testcase_01 AC 63 ms
71,196 KB
testcase_02 AC 66 ms
71,224 KB
testcase_03 AC 68 ms
71,492 KB
testcase_04 AC 67 ms
71,472 KB
testcase_05 AC 68 ms
71,204 KB
testcase_06 AC 66 ms
71,364 KB
testcase_07 AC 69 ms
71,260 KB
testcase_08 AC 65 ms
71,284 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
S=input()
L = len(S)
AB = [-1]*L
for i in range(L):
    if S[i]=='A':
        AB[i] = 1
ACC = [0] + list(itertools.accumulate(AB))
ans = 0
for i in range(L+1):
    for j in range(i+1,L+1):
        if(ACC[i]==ACC[j] and ans < j-i):
            ans = j-i
print(ans)
0