結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kpinkcat
提出日時 2023-11-06 03:01:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 1,000 ms
コード長 888 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 195,420 KB
最終ジャッジ日時 2025-02-17 19:47:44
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main(){
    int n, ans = -1;
    string days, s, app = "xxxxxxxxxxxxxx";
    cin >> n >> days >> s;
    days += s;
    days = app + days;
    days += app;
    for (int i = 0; i < 43 - n; i++) {
        string tmp = days, tmp1;
        int cnt = 0, xcnt = 0;
        for (int j = i; j < i + n; j++){
            if (tmp[j] == 'x') tmp[j] = 'o';
            else break;
        }
        for (int j = 0; j < 42; j++){
            if (tmp[j] == 'o') cnt++;
            else {
                ans = max(ans, cnt);
                cnt = 0;
            }
            if (j == 41 && cnt) ans = max(ans, cnt);
        }
    }
    cout << ans << endl;
}
0