結果
問題 | No.672 最長AB列 |
ユーザー |
![]() |
提出日時 | 2020-11-05 13:22:33 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 275 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 82,344 KB |
実行使用メモリ | 94,592 KB |
最終ジャッジ日時 | 2024-07-22 10:57:08 |
合計ジャッジ時間 | 1,934 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 6 |
ソースコード
S=input()L = len(S)d = {}d[0] = 0cnt = 0ans = 0for i in range(L):if S[i]=='A':cnt += 1else:cnt -=1if cnt not in d:# キーが存在しない場合の処理d[cnt] = ielse:ans = max(ans,i-d[cnt])print(ans)