結果

問題 No.2711 Connecting Lights
ユーザー 👑 KA37RIKA37RI
提出日時 2024-03-31 15:14:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,533 ms / 5,000 ms
コード長 586 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 75,944 KB
最終ジャッジ日時 2024-03-31 15:15:31
合計ジャッジ時間 30,073 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 44 ms
66,332 KB
testcase_03 AC 34 ms
53,460 KB
testcase_04 AC 33 ms
53,460 KB
testcase_05 AC 87 ms
75,600 KB
testcase_06 AC 64 ms
75,588 KB
testcase_07 AC 62 ms
75,600 KB
testcase_08 AC 101 ms
75,600 KB
testcase_09 AC 2,035 ms
75,816 KB
testcase_10 AC 1,548 ms
75,676 KB
testcase_11 AC 2,713 ms
75,812 KB
testcase_12 AC 740 ms
75,588 KB
testcase_13 AC 835 ms
75,716 KB
testcase_14 AC 129 ms
75,600 KB
testcase_15 AC 472 ms
75,592 KB
testcase_16 AC 96 ms
75,600 KB
testcase_17 AC 103 ms
75,600 KB
testcase_18 AC 162 ms
75,600 KB
testcase_19 AC 2,175 ms
75,676 KB
testcase_20 AC 911 ms
75,716 KB
testcase_21 AC 91 ms
75,600 KB
testcase_22 AC 66 ms
75,600 KB
testcase_23 AC 72 ms
75,624 KB
testcase_24 AC 1,295 ms
75,688 KB
testcase_25 AC 1,557 ms
75,688 KB
testcase_26 AC 3,395 ms
75,944 KB
testcase_27 AC 3,333 ms
75,812 KB
testcase_28 AC 3,533 ms
75,944 KB
testcase_29 AC 3,286 ms
75,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

md = 998244353

def solve(n, m, k):
  cnt = [1] * (1 << n)
  for _ in range(m - 1):
    nxt_cnt = [0] * (1 << n)
    for i in range(1 << n):
      for j in range(1 << n):
        if bin(i & j).count("1") >= k:
          nxt_cnt[j] += cnt[i]
    for i in range(1 << n):
      nxt_cnt[i] %= md
    cnt = nxt_cnt
  return sum(cnt) % md

def solve1(n, k):
  ans = 0
  for i in range(1 << n):
    if bin(i).count("1") >= k:
      ans += 1
  return ans

n, m, k = [int(x) for x in input().split()]

# if m == 1:
#   print(solve1(n, k))
# else:
#   print(solve(n, m, k))

print(solve(n, m, k))
0