結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
gt_ham_bass
|
| 提出日時 | 2018-04-13 23:40:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 350 bytes |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 54,492 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-06-27 19:50:51 |
| 合計ジャッジ時間 | 4,047 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 TLE * 1 -- * 9 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int i,ans,ANS;
string s;
int main() {
std::cin >> s;
int n = s.size();
for(int j = 0; j < n;j++){
ANS = 0;
for(i = 0; i + j < n; i++){
if(s[i+j] == 'A') ANS++;
else if(s[i+j] == 'B') ANS--;
if(ANS == 0) ans = max(ans,i+1);
}
}
std::cout << ans << std::endl;
}
gt_ham_bass