結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2018-05-21 22:26:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 366 bytes |
コンパイル時間 | 547 ms |
コンパイル使用メモリ | 66,432 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-28 15:37:02 |
合計ジャッジ時間 | 4,021 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; ll len = str.size(); for(ll i=0;i<len;i++){ ll count=0; if((len-i)<ans) break; for(ll j=i;j<len;j++){ if(str[j]=='A') count++; else count--; if(count==0) ans = max(ans,j-i+1); } } cout << ans << endl; return 0; }