結果
| 問題 | No.672 最長AB列 |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-10-16 22:46:52 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 195 bytes |
| 記録 | |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 85,676 KB |
| 実行使用メモリ | 96,312 KB |
| 最終ジャッジ日時 | 2026-05-05 13:51:40 |
| 合計ジャッジ時間 | 2,752 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
norioc