結果

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

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int cnt(string s){
	int count = 0;
	int max_day = 0;
	for (int i = 0; i < 14; i++){
		if (s[i] == 'o'){
			count++;
		}
		else{
			max_day = max(max_day, count);
			count = 0;
		}
	}
	max_day = max(max_day, count);
	return max_day;
}
int main()
{
	string s, s2,t;
	int n;
	cin >> n;
	cin >> s >> s2;
	s += s2;
	vector<int>p;
	for (int i = 0; i < s.size(); i++){
		if (s[i] == 'x'){
			p.push_back(i);
		}
	}
	int max_v = 0;
	for (int i = 0; i < p.size(); i++){
		int count = 0;
		t = s;
		for (int i2 = i; i2 < p.size()&&count<n; i2++,count++){
			t[p[i2]] = 'o';
		}
		
		max_v = max(max_v, cnt(t));
		if (t == "oooooooooooooo"){
			max_v += n - count;
		}
		
	}
	cout << max_v << endl;
}
0