結果
| 問題 |
No.2711 Connecting Lights
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-03 22:02:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 103 ms / 5,000 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 2,863 ms |
| コンパイル使用メモリ | 250,632 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2024-10-01 00:07:09 |
| 合計ジャッジ時間 | 4,420 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll N, M, K;
cin >> N >> M >> K;
if(M == 1) {
cout << (1 << N) << "\n";
return 0;
}
vector<vector<mint>> dp(M + 1, vector<mint>(1 << N, 0));
dp[0].back() = 1;
for(ll i = 0; i < M; i++) {
for(ll j = 0; j < 1 << N; j++) {
for(ll k = 0; k < 1 << N; k++) {
unsigned b = j & k;
if(popcount(b) >= K) { dp[i + 1][k] += dp[i][j]; }
}
}
}
cout << accumulate(dp[M].begin(), dp[M].end(), mint(0)).val() << "\n";
}