結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー fura
提出日時 2020-03-14 18:24:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 466 bytes
コンパイル時間 1,971 ms
コンパイル使用メモリ 196,628 KB
最終ジャッジ日時 2025-01-09 06:52:34
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

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(){
	string s1,s2; cin>>s1>>s2;

	int ans=0;
	for(auto p:run_length_encoding(s1+s2)) if(p.first=='o') ans=max(ans,p.second);
	printf("%d\n",ans);

	return 0;
}
0