結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2018-05-21 22:20:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 333 bytes |
コンパイル時間 | 505 ms |
コンパイル使用メモリ | 66,584 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-28 15:36:44 |
合計ジャッジ時間 | 4,173 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 TLE * 1 -- * 9 |
ソースコード
#include<iostream> #include<algorithm> using ll = long long ; using namespace std; int main(){ string str; ll ans=0; cin >> str; for(ll i=0;i<str.size();i++){ ll count=0; for(ll j=i;j<str.size();j++){ if(str[j]=='A') count++; else count--; if(count==0) ans = max(ans,j-i+1); } } cout << ans << endl; return 0; }