結果

問題 No.2711 Connecting Lights
ユーザー tobbietobbie
提出日時 2024-05-01 11:37:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 1,639 ms
コンパイル使用メモリ 171,144 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 11:37:37
合計ジャッジ時間 4,010 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 4 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 100 ms
6,944 KB
testcase_10 AC 63 ms
6,944 KB
testcase_11 AC 112 ms
6,944 KB
testcase_12 AC 27 ms
6,940 KB
testcase_13 AC 29 ms
6,944 KB
testcase_14 AC 4 ms
6,944 KB
testcase_15 AC 18 ms
6,940 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 4 ms
6,940 KB
testcase_18 AC 5 ms
6,944 KB
testcase_19 AC 88 ms
6,940 KB
testcase_20 AC 33 ms
6,940 KB
testcase_21 AC 4 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 3 ms
6,940 KB
testcase_24 AC 58 ms
6,940 KB
testcase_25 AC 78 ms
6,940 KB
testcase_26 AC 171 ms
6,944 KB
testcase_27 AC 140 ms
6,940 KB
testcase_28 AC 171 ms
6,940 KB
testcase_29 AC 131 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 998244353
using ll = long long int;

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  auto count_bit = [&](int x, int b) {
    int rtn = 0;
    rep(i, b)
      if ((x>>i) & 1)
	rtn++;
    return rtn;
  };
  vector<vector<int>> dp(M, vector<int> (1<<N, 0));
  rep(i, M-1) {
    rep(j, 1<<N) {
      rep(j1, 1<<N) {
	if (count_bit(j & j1, N) >= K) {
	  if (i == 0) dp[i+1][j1] = dp[i+1][j1] + 1;
	  else	      dp[i+1][j1] = (dp[i+1][j1] + dp[i][j]) % MOD;
	}
      }
    }
  }
  int ans = 0;
  rep(i, 1<<N)
    ans = (ans + dp[M-1][i]) % MOD;
  cout << ans << endl;
  return 0;
}
0