結果

問題 No.672 最長AB列
ユーザー syunsukesyunsuke
提出日時 2018-06-24 22:57:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 437 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 12,780 KB
最終ジャッジ日時 2023-09-13 13:48:19
合計ジャッジ時間 3,927 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,928 KB
testcase_01 AC 14 ms
7,724 KB
testcase_02 AC 17 ms
7,716 KB
testcase_03 AC 16 ms
7,836 KB
testcase_04 AC 16 ms
7,748 KB
testcase_05 AC 16 ms
7,704 KB
testcase_06 AC 15 ms
7,772 KB
testcase_07 AC 15 ms
7,776 KB
testcase_08 AC 15 ms
7,772 KB
testcase_09 AC 16 ms
8,292 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
A=S.count("A")
B=S.count("B")
m=[A,B]
#print(min(m))
if min(m)==0:
    print(0)
else:
    list1=[]
    for i in range(min(m)):
        
        for j in range(len(S)-2*min(m)+1+2*i):
            if len(S[j:j+2*min(m)-2*i])==2*S[j:j+2*min(m)-2*i].count("A"):
                list1.append(len(S[j:j+2*min(m)-2*i]))
                i=min(m)
                break
            else:
                j+=1
        
    print(list1[0])
0