結果
問題 |
No.2711 Connecting Lights
|
ユーザー |
|
提出日時 | 2024-03-31 18:18:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,845 ms / 5,000 ms |
コード長 | 971 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 83,192 KB |
最終ジャッジ日時 | 2024-09-30 21:15:08 |
合計ジャッジ時間 | 26,260 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
# 標準入力された値を整数に変換する def INT(): return int(input()) # 標準入力された複数の値を整数に変換する def MI(): return map(int, input().split()) # 標準入力された複数の値を整数のリストに変換する def LI(): return list(map(int, input().split())) def popcount(b, n): cnt = 0 for i in range(n): if (b >> i) & 1: cnt += 1 return cnt N, M, K = MI() dp = [[0 for j in range(1 << N)] for i in range(M)] MOD = 998244353 for i in range(1 << N): dp[0][i] = 1 for i in range(M - 1): for s in range(1 << N): for t in range(1 << N): common = 0 for d in range(N): if (s >> d) & 1 == 1 and (t >> d) & 1 == 1: common += 2**d if popcount(common, N) >= K: dp[i + 1][t] += dp[i][s] dp[i + 1][t] %= MOD ans = sum(dp[M - 1]) % MOD # print(dp) print(ans)