結果

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

ソースコード

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

	int res=0;
	for(int i=0;i<l.size();i++){
		if(r[i]-l[i]+1>d) continue;
		string ss=s;
		for(int j=l[i];j<=r[i];j++) ss[j]='o';
		
		int now=0;
		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