結果

問題 No.672 最長AB列
ユーザー _matumo__matumo_
提出日時 2020-12-16 18:01:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 128 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 11,820 KB
実行使用メモリ 36,492 KB
最終ジャッジ日時 2023-10-20 09:43:32
合計ジャッジ時間 3,905 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,020 KB
testcase_01 AC 30 ms
10,020 KB
testcase_02 AC 29 ms
10,020 KB
testcase_03 AC 28 ms
10,020 KB
testcase_04 WA -
testcase_05 AC 27 ms
10,020 KB
testcase_06 AC 28 ms
10,020 KB
testcase_07 AC 28 ms
10,020 KB
testcase_08 AC 28 ms
10,020 KB
testcase_09 AC 130 ms
36,492 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 172 ms
10,392 KB
testcase_14 WA -
testcase_15 AC 184 ms
10,392 KB
testcase_16 AC 172 ms
10,392 KB
testcase_17 AC 159 ms
23,388 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
v={}
m=y=0
for i,c in enumerate(S):
    y+=(c>'A')*2-1
    if y in v:  m=max(m,i-v[y])
    else:       v[y]=i
print(m)
0