結果
| 問題 |
No.2711 Connecting Lights
|
| ユーザー |
|
| 提出日時 | 2024-03-31 15:12:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 5,000 ms |
| コード長 | 713 bytes |
| コンパイル時間 | 3,832 ms |
| コンパイル使用メモリ | 254,948 KB |
| 最終ジャッジ日時 | 2025-02-20 17:43:54 |
|
ジャッジサーバーID (参考情報) |
judge5 / 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(int S = 0; S < (1 << h); S++){
for(auto &&U : T[S]) ndp[U] += dp[S];
}
swap(ndp, dp);
}
cout << accumulate(dp.begin(), dp.end(), mint(0)).val() << '\n';
}