結果
問題 |
No.2711 Connecting Lights
|
ユーザー |
|
提出日時 | 2024-03-31 15:13:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 704 bytes |
コンパイル時間 | 3,924 ms |
コンパイル使用メモリ | 253,856 KB |
最終ジャッジ日時 | 2025-02-20 17:44:51 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); int h, w, K; cin >> h >> w >> K; vector<vector<int>> T(1 << h); vector<mint> dp(1 << h, 1); for(int S = 0; S < (1 << h); S++){ for(int U = 0; U < (1 << h); U++){ if(__builtin_popcount(S & U) >= K) T[S].emplace_back(U); } } for(int x = 1; x < w; x++){ vector<mint> ndp(1 << h); for(auto &&S : T.back()){ for(auto &&U : T[S]) ndp[U] += dp[S]; } swap(ndp, dp); } cout << accumulate(dp.begin(), dp.end(), mint(0)).val() << '\n'; }