結果

問題 No.672 最長AB列
ユーザー Kiri8128Kiri8128
提出日時 2020-09-06 16:49:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 203 bytes
コンパイル時間 863 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 81,176 KB
最終ジャッジ日時 2023-08-19 14:05:35
合計ジャッジ時間 4,598 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,388 KB
testcase_01 AC 74 ms
75,448 KB
testcase_02 AC 74 ms
75,568 KB
testcase_03 AC 75 ms
75,508 KB
testcase_04 WA -
testcase_05 AC 74 ms
75,596 KB
testcase_06 AC 73 ms
75,096 KB
testcase_07 AC 74 ms
75,284 KB
testcase_08 AC 74 ms
75,196 KB
testcase_09 AC 81 ms
80,392 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 94 ms
80,900 KB
testcase_14 WA -
testcase_15 AC 100 ms
81,072 KB
testcase_16 AC 98 ms
80,972 KB
testcase_17 AC 88 ms
80,908 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
X = [1 << 19] * (1 << 19)
X[0] = 0
t = 0
ma = 0
for i, a in enumerate(S):
    if a == "A":
        t += 1
    else:
        t -= 1
    ma = max(ma, i - X[t])
    X[t] = min(X[t], i)
print(ma)
0