結果
問題 | No.672 最長AB列 |
ユーザー |
|
提出日時 | 2018-04-14 11:43:52 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 117 ms / 2,000 ms |
コード長 | 218 bytes |
コンパイル時間 | 960 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 33,608 KB |
最終ジャッジ日時 | 2024-06-27 20:05:59 |
合計ジャッジ時間 | 3,016 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#yuki672from collections import defaultdicts=raw_input()d=defaultdict(int)p=0d[0]=-1res=0for i in xrange(len(s)):if s[i]=='A':p+=1else:p-=1if p in d:res=max(res,i-d[p])else:d[p]=iprint res