結果
問題 | No.2711 Connecting Lights |
ユーザー |
![]() |
提出日時 | 2024-03-31 14:31:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 133 ms / 5,000 ms |
コード長 | 651 bytes |
コンパイル時間 | 2,390 ms |
コンパイル使用メモリ | 194,764 KB |
最終ジャッジ日時 | 2025-02-20 17:16:33 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N, M, K;cin >> N >> M >> K;constexpr int MOD = 998244353;vector<int> dp(1<<N), ep(1<<N);fill(dp.begin(), dp.end(), 1);for(int i = 0; i < M-1; i++) {for(int s = 0; s < 1<<N; s++) {for(int t = 0; t < 1<<N; t++) {int cnt = 0;for(int j = 0; j < N; j++) cnt += (s>>j)&(t>>j)&1;ep[t] += dp[s]*(cnt >= K);ep[t] -= MOD*(ep[t] >= MOD);}}swap(dp, ep);fill(ep.begin(), ep.end(), 0);}int ans = 0;for(int s = 0; s < 1<<N; s++) {ans += dp[s];ans -= MOD*(ans >= MOD);}cout << ans << endl;}