結果

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

ソースコード

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 < 41 - n; i++) {
        string tmp = days, tmp1;
        int cnt = 0, xcnt = 0;
        for (int j = i; j < i + n; j++){
            if (tmp[j] == 'x') xcnt++;
        }
        if (xcnt == n){
            app = "";
            for (int i = 0; i < n; i++) app += "o";
            tmp1 = tmp.substr(i+n);
            tmp = tmp.substr(0, i);
            tmp += app;
            tmp += tmp1;
        }
        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