結果
問題 |
No.2711 Connecting Lights
|
ユーザー |
|
提出日時 | 2024-07-04 16:41:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 275 ms / 5,000 ms |
コード長 | 999 bytes |
コンパイル時間 | 5,161 ms |
コンパイル使用メモリ | 313,268 KB |
実行使用メモリ | 6,656 KB |
最終ジャッジ日時 | 2024-07-04 16:41:54 |
合計ジャッジ時間 | 7,388 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #ifdef LOCAL #include <algo/debug.h> #else #define debug(...) void(0) #endif #include<atcoder/all> using namespace atcoder; using mint = modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M, K; cin >> N >> M >> K; vector<vector<mint>> dp(M + 1, vector<mint>(1 << N, 0)); for(int i = 0; i < (1 << N); i++) dp[1][i]++; for(int i = 0; i < M; i++) { for(int bit1 = 0; bit1 < (1 << N); bit1++) { if(__builtin_popcount(bit1) < K) continue; for(int bit2 = 0; bit2 < (1 << N); bit2++) { if(__builtin_popcount(bit2) < K) continue; if(__builtin_popcount(bit1 & bit2) >= K) { dp[i + 1][bit1] += dp[i][bit2]; } } } } mint ans = 0; for(int i = 0; i < (1 << N); i++) { ans += dp[M][i]; } cout << ans.val() << endl; }