結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー snrnsidy
提出日時 2021-06-08 10:33:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 689 bytes
コンパイル時間 2,866 ms
コンパイル使用メモリ 194,296 KB
最終ジャッジ日時 2025-01-22 04:53:12
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int D;
	string s1, s2;

	cin >> D;
	cin >> s1;
	cin >> s2;
	s1 += s2;

	string s = "";
	for (int i = 0; i < D; i++)
	{
		s += 'x';
	}
	s1 = s + s1;
	s1 = s1 + s;
	int res = 0;
	int cnt = 0;

	for (int t = 0; t <= s1.length() - D; t++)
	{
		string s = s1;
		for (int i = t; i < t + D; i++)
		{
			if (s[i] == 'o') break;
			s[i] = 'o';
		}
		//cout << s << '\n';
		cnt = 0;
		for (int i = 0; i < s.length(); i++)
		{
			if (s[i] == 'o')
			{
				cnt++;
				res = max(res, cnt);
			}
			else
			{
				cnt = 0;
			}
		}
		res = max(res, cnt);
	}
	cout << res << '\n';


	return 0;
}
0