結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2024-10-16 22:46:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 195 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 94,720 KB |
最終ジャッジ日時 | 2024-10-16 22:46:55 |
合計ジャッジ時間 | 3,003 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 6 |
ソースコード
S = input() d = {} h = 0 ans = 0 for i, c in enumerate(S): if c == 'A': h += 1 if c == 'B': h -= 1 if h in d: ans = max(ans, i - d[h]) else: d[h] = i print(ans)