結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー Lay_ec
提出日時 2015-05-08 22:57:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 958 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 84,692 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 11:40:39
合計ジャッジ時間 2,159 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 28 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;


int main()
{
		
	int d;
	string s,t;
	cin>>d>>s>>t;
	s+=t;
	
	vector<int> l,r;

	
	for(int i=0;i<s.size() && d!=0;i++){
		if(s[i]=='o') continue;
		
		bool f=true;
		l.push_back(i);
		for(int j=i+1;j<s.size();j++){
			if(s[j]=='o' || j-i+1>d){
				r.push_back(j-1);
				f=false;
				break;
			}
			if(j==s.size()-1 && s[j]=='x') r.push_back(s.size()-1);
		}
		
	}

	//cout<<s<<endl;

	int res=0;
	for(int i=0;i<l.size();i++){
		string ss=s;
		int now=0;
		for(int j=l[i];j<=r[i];j++) ss[j]='o';
		//cout<<ss<<endl;
		
		for(int j=0;j<ss.size();j++){
			if(ss[j]=='o') now++;
			else{
				res=max(res,now);
				now=0;
			}
		}
		res=max(res,now);
	}

	cout<<res<<endl;

	return 0;
}
0