結果

問題 No.2711 Connecting Lights
ユーザー 👑 timitimi
提出日時 2024-03-31 19:31:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 384 ms / 5,000 ms
コード長 678 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 75,576 KB
最終ジャッジ日時 2024-03-31 19:31:41
合計ジャッジ時間 4,595 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 49 ms
62,096 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 53 ms
66,356 KB
testcase_06 AC 48 ms
62,356 KB
testcase_07 AC 49 ms
64,308 KB
testcase_08 AC 53 ms
64,304 KB
testcase_09 AC 249 ms
75,576 KB
testcase_10 AC 111 ms
75,568 KB
testcase_11 AC 158 ms
75,568 KB
testcase_12 AC 141 ms
75,568 KB
testcase_13 AC 133 ms
75,568 KB
testcase_14 AC 55 ms
66,352 KB
testcase_15 AC 104 ms
72,624 KB
testcase_16 AC 53 ms
66,356 KB
testcase_17 AC 55 ms
68,404 KB
testcase_18 AC 59 ms
68,400 KB
testcase_19 AC 135 ms
75,568 KB
testcase_20 AC 162 ms
75,568 KB
testcase_21 AC 54 ms
66,356 KB
testcase_22 AC 50 ms
64,308 KB
testcase_23 AC 51 ms
66,356 KB
testcase_24 AC 139 ms
75,460 KB
testcase_25 AC 202 ms
75,576 KB
testcase_26 AC 384 ms
75,576 KB
testcase_27 AC 204 ms
75,568 KB
testcase_28 AC 379 ms
75,576 KB
testcase_29 AC 176 ms
75,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K=map(int, input().split())
mod=998244353
dp=[1]*(2**N)
def popcnt(n):
  c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
  c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
  c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f)
  c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff)
  c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff)
  c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff)
  return c

for _ in range(M-1):
  ndp=[0]*(2**N)
  for i in range(2**N):
    for j in range(2**N):
      nex=i&j
      if popcnt(nex)>=K:
        ndp[j]+=dp[i]
        ndp[j]%=mod 
  dp=ndp 
print(sum(dp)%mod)
0