結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー fura
提出日時 2020-04-25 21:36:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 2,273 ms
コンパイル使用メモリ 196,136 KB
最終ジャッジ日時 2025-01-10 01:40:26
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

vector<pair<char,int>> run_length_encoding(const string& s){
	vector<pair<char,int>> res;
	int n=s.length(),pre=0;
	rep(i,n) if(i==n-1 || s[i]!=s[i+1]) res.emplace_back(s[i],i-pre+1), pre=i+1;
	return res;
}

int main(){
	int d;
	string s1,s2; cin>>d>>s1>>s2;

	int ans=0;
	rep(i,14-d+1){
		string t=s1+s2;
		rep(j,d){
			if(t[i+j]=='o') break;
			t[i+j]='o';
		}
		for(auto p:run_length_encoding(t)) if(p.first=='o') ans=max(ans,p.second);
	}
	cout<<ans<<'\n';

	return 0;
}
0