結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー dnish
提出日時 2017-07-08 11:11:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 1,641 ms
コンパイル使用メモリ 168,492 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 19:38:27
合計ジャッジ時間 3,044 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define p(s) cout<<(s)<<endl
using namespace std;

int main() {
	int D;
	string s,s1,x;
	x="xxxxxxxxxxxxxx";
	cin>>D>>s>>s1;
	s=x+s+s1+x;
	p(s);
	int ans=0;
	REP (i,0,s.size()-D+1) {
		int cnt = 0;
		int mx = 0;
		s1 = s;
		REP (j,0,D) {
			if (s1[j+i] == 'o') break;
			s1[j+i] = 'o';
		}
		REP (j,0,s1.size()) {
			if (s1[j] == 'o') {
				cnt++;
			} else {
				mx = max(cnt, mx);
				cnt = 0;
			}
		}
		mx = max(cnt, mx);
		ans = max(ans, mx);
	}
	p(ans);
	return 0;
}
0