結果
| 問題 |
No.2711 Connecting Lights
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-01 20:26:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 5,000 ms |
| コード長 | 990 bytes |
| コンパイル時間 | 3,730 ms |
| コンパイル使用メモリ | 326,320 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-01 20:27:03 |
| 合計ジャッジ時間 | 5,159 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <atcoder/modint>
#include <bits/extc++.h>
namespace atcoder {
template <int m>
std::ostream &operator<<(std::ostream &os, static_modint<m> n) {
return os << n.val();
}
template <int m>
std::istream &operator>>(std::istream &is, static_modint<m> &n) {
int tmp;
is >> tmp;
n = tmp;
return is;
}
} // namespace atcoder
int main() {
using namespace std;
using modint = atcoder::static_modint<998244353>;
unsigned N, M, K;
cin >> N >> M >> K;
vector<modint> dp(1U << N, 1), prev(1U << N);
vector<pair<unsigned, unsigned>> edges;
for (unsigned i{}; i < 1U << N; i++)
for (unsigned j{}; j < 1U << N; j++)
if (popcount(i & j) >= K)
edges.emplace_back(i, j);
for (unsigned i{1}; i < M; i++) {
swap(dp, prev);
ranges::fill(dp, 0);
for (const auto &[from, to] : edges)
dp[to] += prev[from];
}
cout << reduce(cbegin(dp), cend(dp)) << endl;
return 0;
}