結果

問題 No.2711 Connecting Lights
ユーザー Hydrogen332
提出日時 2025-03-27 00:39:19
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 693 bytes
コンパイル時間 3,648 ms
コンパイル使用メモリ 278,936 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2025-03-27 00:39:26
合計ジャッジ時間 6,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()

#include <atcoder/modint>
using namespace atcoder;
using mint = modint998244353;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int N, M, K;
    cin >> N >> M >> K;
    
    vector dp(M, vector<mint>(1 << N, 0));
    rep(S, 0, 1 << N) dp[0][S] = 1;
    
    rep(i, 1, M) rep(S, 0, 1 << N) {
        rep(T, 0, 1 << N) if (__builtin_popcount(S & T) >= K) dp[i][S] += dp[i - 1][T];
    }
    
    mint ans = 0;
    rep(S, 0, 1 << N) ans += dp[M - 1][S];
    
    cout << ans.val() << '\n';
}
0