結果
問題 | No.672 最長AB列 |
ユーザー |
![]() |
提出日時 | 2020-05-15 16:15:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 274 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 37,016 KB |
最終ジャッジ日時 | 2024-09-19 03:02:42 |
合計ジャッジ時間 | 3,118 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 6 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() import collections D=collections.defaultdict(int) S=input() cur=0 ans=0 for i in range(len(S)): if S[i]=="A": cur+=1 else: cur-=1 if D[cur]==0: D[cur]=i+1 else: ans=max(ans,i+1-D[cur]) print(ans)