結果

問題 No.2669 Generalized Hitting Set
ユーザー 👑 rin204rin204
提出日時 2024-04-01 23:31:06
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,124 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 348,020 KB
最終ジャッジ日時 2024-04-01 23:31:46
合計ジャッジ時間 38,170 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 50 ms
64,312 KB
testcase_03 AC 102 ms
81,796 KB
testcase_04 AC 94 ms
80,644 KB
testcase_05 AC 88 ms
79,876 KB
testcase_06 AC 117 ms
82,948 KB
testcase_07 AC 65 ms
76,800 KB
testcase_08 AC 69 ms
77,188 KB
testcase_09 AC 99 ms
80,260 KB
testcase_10 AC 81 ms
78,084 KB
testcase_11 AC 76 ms
77,060 KB
testcase_12 AC 120 ms
81,284 KB
testcase_13 MLE -
testcase_14 AC 419 ms
108,476 KB
testcase_15 AC 60 ms
68,500 KB
testcase_16 AC 150 ms
83,900 KB
testcase_17 AC 420 ms
108,476 KB
testcase_18 AC 57 ms
66,420 KB
testcase_19 AC 101 ms
76,672 KB
testcase_20 AC 55 ms
66,420 KB
testcase_21 AC 146 ms
83,900 KB
testcase_22 AC 77 ms
72,604 KB
testcase_23 AC 189 ms
85,156 KB
testcase_24 AC 140 ms
82,328 KB
testcase_25 AC 251 ms
91,300 KB
testcase_26 MLE -
testcase_27 AC 142 ms
82,212 KB
testcase_28 MLE -
testcase_29 MLE -
testcase_30 MLE -
testcase_31 MLE -
testcase_32 MLE -
testcase_33 AC 206 ms
86,948 KB
testcase_34 AC 155 ms
83,864 KB
testcase_35 AC 920 ms
147,492 KB
testcase_36 AC 37 ms
53,460 KB
testcase_37 AC 247 ms
91,964 KB
testcase_38 AC 65 ms
69,512 KB
testcase_39 MLE -
testcase_40 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline


n, m, k = map(int, input().split())

PC = [0] * (1 << n)
for i in range(1, 1 << n):
    p = i & -i
    PC[i] = PC[i ^ p] + 1

nCk = [[0] * (n + 1) for _ in range(n + 1)]
nCk[0][0] = 1
for i in range(1, n + 1):
    nCk[i][0] = 1
    for j in range(1, i + 1):
        nCk[i][j] = nCk[i - 1][j - 1] + nCk[i - 1][j]


dp = [0] * (1 << n)
for _ in range(m):
    S = int(input(), 2)
    dp[S] += 1

C = [0] * (n + 1)
C[k] = 1
for i in range(k + 1, n + 1):
    C[i] = 1
    for j in range(i):
        C[i] -= C[j] * nCk[i][j]


for i in range(n):
    dbit = 1 << i
    for s in range(0, 1 << n, 2 * dbit):
        for j in range(s, s + dbit):
            dp[j] += dp[dbit | j]

for bit, p in enumerate(PC):
    dp[bit] *= C[p]

for i in range(n):
    dbit = 1 << i
    for s in range(0, 1 << n, 2 * dbit):
        for j in range(s, s + dbit):
            dp[dbit | j] += dp[j]


ans = [1 << 30] * m
for bit in range(1 << n):
    c = dp[bit] - 1
    if c >= 0:
        ans[c] = min(ans[c], PC[bit])

for i in range(m - 2, -1, -1):
    ans[i] = min(ans[i], ans[i + 1])

print(*ans, sep="\n")
0