結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
furu_tuww
|
| 提出日時 | 2016-07-10 00:25:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 693 bytes |
| コンパイル時間 | 584 ms |
| コンパイル使用メモリ | 64,360 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-13 14:05:02 |
| 合計ジャッジ時間 | 1,658 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 30 |
ソースコード
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int d;
string s,ss;
int ans = 0;
void ch(int n){
int c = n;
bool f = false;
for(int i = 0; i < (int)s.size(); i++){
if(s[i] == 'x'){
f = true;
ans = max(ans,c);
c = 0;
}else{
c++;
}
}
ans = max(ans,c+(f?n:0));
}
void solve(int k,int n){
if(k >= (int)s.size()) ch(n);
else if(s[k] == 'o') solve(k+1,n);
else{
solve(k+1,n);
if(n){
s[k] = 'o';
solve(k+1,n-1);
s[k] = 'x';
}
}
}
int main(void){
cin >> d;
cin >> s >> ss;
s += ss;
solve(0,d);
cout << ans << endl;
}
furu_tuww