結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー aaaaaaiu
提出日時 2019-08-08 23:57:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 659 bytes
コンパイル時間 1,894 ms
コンパイル使用メモリ 194,800 KB
最終ジャッジ日時 2025-01-07 11:03:51
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int d;
    string s,t;
    cin>>d>>s>>t;
    s+=t;
    s="xxxxxxxxxxxxxx"+s+"xxxxxxxxxxxxxx";
    int n=s.size();
    int mx=0;
    for (int i=0;i<n;i++) {
        int k=0;
        for (int j=0;j<n;j++) {
            if (d!=0&&j==i&&s[j]=='x') {
                while (j<n&&j<i+d&&s[j]=='x') {
                    k++;
                    j++;
                }
                j--;
            } else if (s[j]=='o') {
                k++;
            } else {
                k=0;
            }
            mx=max(mx,k);
        }
    }
    cout<<mx<<endl;
    return 0;
}
0