結果

問題 No.2711 Connecting Lights
ユーザー Nichi10pNichi10p
提出日時 2024-03-31 15:21:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 186 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 2,327 ms
コンパイル使用メモリ 205,792 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-31 15:21:35
合計ジャッジ時間 4,651 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 3 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 3 ms
6,548 KB
testcase_09 AC 109 ms
6,548 KB
testcase_10 AC 73 ms
6,548 KB
testcase_11 AC 126 ms
6,548 KB
testcase_12 AC 27 ms
6,548 KB
testcase_13 AC 31 ms
6,548 KB
testcase_14 AC 4 ms
6,548 KB
testcase_15 AC 19 ms
6,548 KB
testcase_16 AC 3 ms
6,548 KB
testcase_17 AC 4 ms
6,548 KB
testcase_18 AC 6 ms
6,548 KB
testcase_19 AC 99 ms
6,548 KB
testcase_20 AC 34 ms
6,548 KB
testcase_21 AC 3 ms
6,548 KB
testcase_22 AC 2 ms
6,548 KB
testcase_23 AC 3 ms
6,548 KB
testcase_24 AC 63 ms
6,548 KB
testcase_25 AC 84 ms
6,548 KB
testcase_26 AC 186 ms
6,548 KB
testcase_27 AC 184 ms
6,548 KB
testcase_28 AC 184 ms
6,548 KB
testcase_29 AC 150 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

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