結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー Mister
提出日時 2020-04-12 15:13:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 760 bytes
コンパイル時間 842 ms
コンパイル使用メモリ 69,552 KB
最終ジャッジ日時 2025-01-09 17:43:06
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

constexpr int N = 42;

void solve() {
    int d;
    std::cin >> d;

    std::string s;
    s += std::string(14, 'x');

    for (int i = 0; i < 2; ++i) {
        std::string t;
        std::cin >> t;
        s += t;
    }

    s += std::string(14, 'x');

    int ans = 0;
    for (int si = 0; si + d <= N; ++si) {
        int cont = 0;

        for (int i = 0; i < N; ++i) {
            if (s[i] == 'o' || (si <= i && i < si + d)) {
                ++cont;
            } else {
                cont = 0;
            }
            ans = std::max(ans, cont);
        }
    }

    std::cout << ans << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0