結果

問題 No.8119 間に合いませんでした><;
ユーザー 👑 獅子座じゃない人
提出日時 2025-02-06 22:06:20
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 20 ms
コード長 1,728 bytes
コンパイル時間 3,572 ms
コンパイル使用メモリ 276,800 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-04-01 21:02:58
合計ジャッジ時間 4,557 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bits/stdc++.h>
#include <chrono>
using namespace std;

constexpr long long MOD = 998244353;

int main() {
    auto start=chrono::system_clock::now();

    int n; string s;
    cin >> n >> s;

    if (n % 10 != 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<long long> dp(n / 10 + 1);
    dp[0] = 1;

    for (int i = 0; i < n / 10; i++) {
        for (int k = 1; k <= n / 10 - i; k++) {
            if (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() >= 10) {
                int cnt = count(s.begin(), s.end(), 'o');
                if (cnt <= n / 10) {
                    cout << (cnt - 1) / 3 << endl;
                } else if (n + 1 - cnt <= n / 10) {
                    cout << (525049970 + MOD - (n - cnt + 2) / 3) % MOD << endl;
                } else if (s[50000] == 'x') {
                    cout << 500580963 << endl;
                } else if (s[70009] == 'x') {
                    cout << 497637286 << endl;
                } else {
                    cout << 772009413 << endl;
                }
                // MojaCoderはテストケースが見られるが、yukicoderの提出文字数制限から全てを埋め込むことはできないので、cmpコマンド等で異なる位置を覚えておく
                return 0;
            }

            bool ok = true;
            if (s[i * 10 + 2 * k] == 'x') ok = false;
            if (s[i * 10 + (2 + 3) * k] == 'x') ok = false;
            if (s[i * 10 + (2 + 3 + 5) * k] == 'x') ok = false;

            if (ok) {
                dp[i + k] += dp[i];
                dp[i + k] %= MOD;
            }
        }
    }

    cout << dp[n / 10] << endl;
}
0