結果
問題 |
No.672 最長AB列
|
ユーザー |
|
提出日時 | 2019-01-01 21:21:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 250 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 38,260 KB |
最終ジャッジ日時 | 2024-11-08 02:34:21 |
合計ジャッジ時間 | 3,319 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 6 |
ソースコード
# -*- coding: utf-8 -*- s = list(input()) n = len(s) d = {} cnt = 0 res = 0 for i in range(n): if s[i]=="A": cnt += 1 else: cnt -= 1 if cnt in d: res = max(res, i-d[cnt]) else: d[cnt] = i print(res)