結果
問題 | No.672 最長AB列 |
ユーザー |
![]() |
提出日時 | 2019-12-08 21:54:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 204 ms / 2,000 ms |
コード長 | 223 bytes |
コンパイル時間 | 325 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 37,152 KB |
最終ジャッジ日時 | 2024-12-31 20:31:15 |
合計ジャッジ時間 | 3,757 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
S = input() a = {0: -1} c = 0 max_len = 0 for i, s in enumerate(S): if s == "A": c += 1 else: c -= 1 if c in a: max_len = max(max_len, i - a[c]) else: a[c] = i print(max_len)