結果

問題 No.2669 Generalized Hitting Set
ユーザー suisensuisen
提出日時 2024-01-16 21:28:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,248 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 209,940 KB
最終ジャッジ日時 2024-01-16 21:29:04
合計ジャッジ時間 35,678 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 RE -
testcase_03 AC 86 ms
79,504 KB
testcase_04 AC 81 ms
78,992 KB
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 85 ms
78,736 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 118 ms
80,016 KB
testcase_13 RE -
testcase_14 AC 404 ms
92,076 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 76 ms
71,564 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 181 ms
82,964 KB
testcase_34 AC 135 ms
81,680 KB
testcase_35 AC 901 ms
113,172 KB
testcase_36 AC 39 ms
59,588 KB
testcase_37 RE -
testcase_38 AC 64 ms
68,984 KB
testcase_39 RE -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

readline = sys.stdin.readline

popcnt = [0] * (2 ** 12)
for t in range(1, 2 ** 12):
    popcnt[t] = 1 + popcnt[t & (t - 1)]

MASK_32 = 2 ** 32 - 1

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

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

f = [0] * (2 ** n)

for i in range(m):
    # reversed, but it's ok
    s = int(readline(), 2)
    f[s] += 1

a = [0] * (n + 1)
for l in range(k, n + 1):
    a[l] = binom[l - 1][l - k]
    if a[l] and ((l - k) & 1):
        a[l] = MASK_32 - a[l]

# supset zeta
b = 1
while b < 2 ** n:
    for l in range(0, 2 ** n, 2 * b):
        for p in range(l, l + b):
            f[p] += f[p + b]
    b *= 2

for t in range(2 ** n):
    f[t] = (f[t] * a[popcnt[t >> 12] + popcnt[t & 0xfff]]) & MASK_32

# subset zeta
b = 1
while b < 2 ** n:
    for l in range(0, 2 ** n, 2 * b):
        for p in range(l, l + b):
            f[p + b] += f[p]
    b *= 2

g = [n + 1] * (m + 1)
for t in range(2 ** n):
    f[t] &= MASK_32
    g[f[t]] = min(g[f[t]], popcnt[t >> 12] + popcnt[t & 0xfff])

for p in reversed(range(m)):
    g[p] = min(g[p], g[p + 1])

print('\n'.join(map(str, g[1:])))
0