結果

問題 No.2711 Connecting Lights
ユーザー blue_jamblue_jam
提出日時 2024-03-31 14:36:21
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 899 bytes
コンパイル時間 4,387 ms
コンパイル使用メモリ 266,204 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-30 19:44:40
合計ジャッジ時間 7,023 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

using ll = long long;
using mint = modint998244353;

int main() {
    ll N, M, K;
    cin >> N >> M >> K;

    vector<vector<mint>> dp(M + 1, vector<mint>(1 << N, 0));
    dp[0][(1 << N) - 1] = 1LL;
    for (ll j = 0; j < M; j++) {
        for (ll s = 0; s < (1 << N); s++) {
            for (ll t = 0; t < (1 << N); t++) {
                ll u = s & t;

                ll cnt = 0;
                for (ll i = 0; i < N; i++) {
                    if (u & (1 << i)) {
                        cnt++;
                    }
                }

                if (cnt >= K) {
                    dp[j + 1][t] += dp[j][s];
                }
            }
        }
    }
    mint ans = 0;
    for (ll s = 0; s < (1 << N); s++) {
        ans += dp[M][s];
    }
    cout << ans.val() << endl;

    return 0;
}
0