結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
focus
|
| 提出日時 | 2018-05-22 15:02:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 350 bytes |
| コンパイル時間 | 865 ms |
| コンパイル使用メモリ | 81,112 KB |
| 実行使用メモリ | 16,128 KB |
| 最終ジャッジ日時 | 2024-06-28 15:44:29 |
| 合計ジャッジ時間 | 2,041 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 9 |
ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using ll = long long ;
using namespace std;
int main(){
string str;
map<ll,ll> m;
ll ans=0,p=0;
cin >> str;
ll len = str.size();
for(ll i=0;i<len;i++){
if(str[i]=='A') p++;
else p--;
if(m.count(p)) ans=(ans,i-m[p]);
else m[p]=i;
}
cout << ans << endl;
return 0;
}
focus