結果
問題 | No.2669 Generalized Hitting Set |
ユーザー | chineristAC |
提出日時 | 2024-01-14 01:49:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 3,923 ms / 4,000 ms |
コード長 | 1,327 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 82,056 KB |
実行使用メモリ | 220,960 KB |
最終ジャッジ日時 | 2024-09-28 02:34:38 |
合計ジャッジ時間 | 42,714 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
65,504 KB |
testcase_01 | AC | 50 ms
67,020 KB |
testcase_02 | AC | 58 ms
71,268 KB |
testcase_03 | AC | 113 ms
84,224 KB |
testcase_04 | AC | 109 ms
83,300 KB |
testcase_05 | AC | 104 ms
82,228 KB |
testcase_06 | AC | 130 ms
86,460 KB |
testcase_07 | AC | 76 ms
78,296 KB |
testcase_08 | AC | 81 ms
79,368 KB |
testcase_09 | AC | 119 ms
83,156 KB |
testcase_10 | AC | 92 ms
80,380 KB |
testcase_11 | AC | 85 ms
78,760 KB |
testcase_12 | AC | 134 ms
84,312 KB |
testcase_13 | AC | 3,707 ms
208,188 KB |
testcase_14 | AC | 480 ms
93,588 KB |
testcase_15 | AC | 67 ms
74,160 KB |
testcase_16 | AC | 165 ms
81,248 KB |
testcase_17 | AC | 481 ms
93,636 KB |
testcase_18 | AC | 65 ms
73,628 KB |
testcase_19 | AC | 117 ms
79,392 KB |
testcase_20 | AC | 63 ms
73,300 KB |
testcase_21 | AC | 163 ms
81,428 KB |
testcase_22 | AC | 95 ms
77,924 KB |
testcase_23 | AC | 202 ms
88,572 KB |
testcase_24 | AC | 150 ms
85,272 KB |
testcase_25 | AC | 265 ms
91,096 KB |
testcase_26 | AC | 3,648 ms
210,348 KB |
testcase_27 | AC | 152 ms
83,924 KB |
testcase_28 | AC | 3,904 ms
220,596 KB |
testcase_29 | AC | 3,923 ms
220,584 KB |
testcase_30 | AC | 3,902 ms
220,316 KB |
testcase_31 | AC | 3,889 ms
220,384 KB |
testcase_32 | AC | 3,860 ms
220,504 KB |
testcase_33 | AC | 214 ms
88,292 KB |
testcase_34 | AC | 163 ms
87,736 KB |
testcase_35 | AC | 1,016 ms
117,940 KB |
testcase_36 | AC | 49 ms
66,316 KB |
testcase_37 | AC | 262 ms
85,796 KB |
testcase_38 | AC | 79 ms
77,836 KB |
testcase_39 | AC | 3,873 ms
220,960 KB |
testcase_40 | AC | 3,886 ms
220,508 KB |
ソースコード
import sys from itertools import permutations from heapq import heappop,heappush from collections import deque import random import bisect input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) n,m,k = mi() cnt = [0] * (1<<n) for _ in range(m): cnt[int(input(),2)] += 1 COMB = [[0]*(n+1) for i in range(n+1)] COMB[0][0] = 1 for i in range(1,n+1): COMB[i][0] = 1 for j in range(1,i+1): COMB[i][j] = COMB[i-1][j] + COMB[i-1][j-1] fact = [1] * (n+1) for i in range(2,n+1): fact[i] = i * fact[i-1] f = [0] * (n+1) f[k] = 1 for i in range(k+1,n+1): f[i] = 1 for j in range(k,i): f[i] -= COMB[i][j] * f[j] #print(f) for i in range(n): t = 1<<i for S in range(0,1<<n,2*t): for SS in range(0,t): cnt[S^SS] += cnt[S^SS^t] #print(cnt) popcnt = [bin(i).count("1") for i in range(1<<12)] mask = 2**12-1 for S in range(1<<n): p = popcnt[S & mask] + popcnt[S>>12] cnt[S] *= f[p] for i in range(n): t = 1<<i for S in range(0,1<<n,2*t): for SS in range(0,t): cnt[S^SS^t] += cnt[S^SS] g = [n+1] * (m+1) for S in range(1<<n): g[cnt[S]] = min(g[cnt[S]],popcnt[S & mask] + popcnt[S>>12]) for i in range(m)[::-1]: g[i] = min(g[i],g[i+1]) print(*g[1:],sep="\n")