結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー ikd
提出日時 2016-07-23 11:37:29
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 62,748 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 14:51:12
合計ジャッジ時間 1,899 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int cal(string s){
    int ret=0, cnt=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='o'){
            cnt++;
            ret=max(ret, cnt);
        }else{
            cnt=0;
        }
    }
    return ret;
}

int main(){

    int D;
    cin>> D;
    string c1, c2;
    cin>> c1>> c2;
    auto C=c1+c2;

    auto B=C;
    reverse(B.begin(), B.end());
    int ans=-1;
    for(int i=0; i<=14; i++){
        auto s=C.substr(0, i)+string(D, 'o');
        auto t=B.substr(0, i)+string(D, 'o');
        for(int i=s.size(); i<14; i++){
            s+=C[i];
            t+=B[i];
        }
        ans=max(ans, max(cal(s), cal(t)));
    }

    cout<< ans<< endl;

    return 0;
}
0