結果

問題 No.2711 Connecting Lights
ユーザー budoubudou
提出日時 2024-04-07 15:48:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 42,796 KB
最終ジャッジ日時 2024-04-07 15:48:41
合計ジャッジ時間 17,340 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 528 ms
42,796 KB
testcase_01 AC 496 ms
42,796 KB
testcase_02 AC 499 ms
42,796 KB
testcase_03 AC 529 ms
42,796 KB
testcase_04 AC 500 ms
42,796 KB
testcase_05 AC 533 ms
42,796 KB
testcase_06 AC 512 ms
42,796 KB
testcase_07 AC 521 ms
42,796 KB
testcase_08 AC 499 ms
42,796 KB
testcase_09 WA -
testcase_10 AC 515 ms
42,796 KB
testcase_11 AC 514 ms
42,796 KB
testcase_12 AC 532 ms
42,796 KB
testcase_13 AC 498 ms
42,796 KB
testcase_14 AC 509 ms
42,796 KB
testcase_15 WA -
testcase_16 AC 496 ms
42,796 KB
testcase_17 AC 514 ms
42,796 KB
testcase_18 AC 502 ms
42,796 KB
testcase_19 AC 530 ms
42,796 KB
testcase_20 AC 495 ms
42,796 KB
testcase_21 AC 533 ms
42,796 KB
testcase_22 AC 492 ms
42,796 KB
testcase_23 AC 502 ms
42,796 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 499 ms
42,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import typing
import sys
input = lambda: sys.stdin.readline().strip()
inf = 10**18
mod = 998244353
import numpy as np

def solve():
  N, M, K = map(int, input().split())
  A = [[0 for _ in range(1 << N)] for _ in range(1 << N)]
  for i in range(1 << N):
    for j in range(1 << N):
      if (i&j).bit_count() >= K:
        A[i][j] = 1
  As = [np.array(A)]
  for _ in range(15):
    As.append(As[-1]@As[-1])
    As[-1]%=mod

  dp = np.ones(1<<N, dtype=int)
  Ans = np.identity(1<<N, dtype=int)
  i = 0
  M -= 1
  
  while M:
    if M % 2 == 1:
      Ans = Ans@As[i]
      Ans%=mod
    M //= 2
    i += 1

  Ans = dp@Ans
  ans = sum(Ans)%mod
  print(ans)
  
def main():
  t = 1
  for _ in range(t):
    solve()
main()

0