結果
| 問題 |
No.2711 Connecting Lights
|
| コンテスト | |
| ユーザー |
prd_xxx
|
| 提出日時 | 2024-03-31 14:29:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 321 ms / 5,000 ms |
| コード長 | 854 bytes |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 82,328 KB |
| 実行使用メモリ | 76,288 KB |
| 最終ジャッジ日時 | 2024-09-30 19:35:43 |
| 合計ジャッジ時間 | 3,800 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
N,M,K = map(int,input().split())
MOD = 998244353
if M==1:
exit(print(1<<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
dp = [0] * (1<<N)
for s in range(1<<N):
if popcnt(s) < K: continue
dp[s] = 1
for _ in range(M-1):
ndp = [0] * (1<<N)
for s in range(1<<N):
if popcnt(s) < K: continue
for t in range(1<<N):
if popcnt(s&t) < K: continue
ndp[t] = (ndp[t] + dp[s]) % MOD
dp = ndp
print(sum(dp) % MOD)
prd_xxx