結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
konsin_tokage
|
| 提出日時 | 2018-04-14 21:45:23 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 216 ms / 2,000 ms |
| コード長 | 200 bytes |
| コンパイル時間 | 101 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 37,236 KB |
| 最終ジャッジ日時 | 2024-06-27 20:09:04 |
| 合計ジャッジ時間 | 2,985 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
s = input()
x = {}
d = r = 0
for i, c in enumerate(s):
if d not in x:
x[d] = i
if c == 'A':
d += 1
else:
d -= 1
if d in x:
r = max(r, i-x[d]+1)
print(r)
konsin_tokage