結果

問題 No.2711 Connecting Lights
ユーザー Nichi10p
提出日時 2024-03-31 15:21:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 198,404 KB
最終ジャッジ日時 2025-02-20 17:51:44
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;

using Int = atcoder::modint998244353;
ostream& operator<<(ostream &os, const Int &x) { return os << x.val(); }

int main() {
  int N, M, K;
  cin >> N >> M >> K;

  vector<Int> dp(1 << N, 1);
  while (--M) {
    vector<Int> _dp(1 << N);
    for (int s=0; s < (1 << N); ++s)
    for (int t=0; t < (1 << N); ++t) {
      int cnt=0;
      for (int i=0; i < N; ++i)
        cnt += (s >> i & 1) & (t >> i & 1);
      if (cnt >= K)
        _dp[t] += dp[s];
    }
    dp = move(_dp);
  }

  Int sum;
  for (Int const &cnt : dp)
    sum += cnt;
  cout << sum << endl;
}
0