結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-25 21:34:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 534 bytes |
| コンパイル時間 | 2,160 ms |
| コンパイル使用メモリ | 195,940 KB |
| 最終ジャッジ日時 | 2025-01-10 01:40:15 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 25 |
ソースコード
#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) t[i+j]='o';
for(auto p:run_length_encoding(t)) if(p.first=='o') ans=max(ans,p.second);
}
printf("%d\n",ans);
return 0;
}