結果
問題 | No.2669 Generalized Hitting Set |
ユーザー | chineristAC |
提出日時 | 2024-01-14 01:51:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 3,422 ms / 4,000 ms |
コード長 | 1,279 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 220,580 KB |
最終ジャッジ日時 | 2024-09-28 02:35:28 |
合計ジャッジ時間 | 37,997 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
67,420 KB |
testcase_01 | AC | 48 ms
66,168 KB |
testcase_02 | AC | 56 ms
69,276 KB |
testcase_03 | AC | 114 ms
84,732 KB |
testcase_04 | AC | 111 ms
83,680 KB |
testcase_05 | AC | 104 ms
82,536 KB |
testcase_06 | AC | 129 ms
86,676 KB |
testcase_07 | AC | 75 ms
78,432 KB |
testcase_08 | AC | 77 ms
79,404 KB |
testcase_09 | AC | 113 ms
82,924 KB |
testcase_10 | AC | 95 ms
80,500 KB |
testcase_11 | AC | 83 ms
78,704 KB |
testcase_12 | AC | 130 ms
84,360 KB |
testcase_13 | AC | 3,173 ms
202,032 KB |
testcase_14 | AC | 398 ms
87,068 KB |
testcase_15 | AC | 64 ms
72,704 KB |
testcase_16 | AC | 137 ms
75,108 KB |
testcase_17 | AC | 404 ms
87,980 KB |
testcase_18 | AC | 62 ms
70,444 KB |
testcase_19 | AC | 99 ms
73,016 KB |
testcase_20 | AC | 63 ms
71,888 KB |
testcase_21 | AC | 144 ms
75,424 KB |
testcase_22 | AC | 82 ms
71,616 KB |
testcase_23 | AC | 201 ms
88,432 KB |
testcase_24 | AC | 144 ms
84,916 KB |
testcase_25 | AC | 256 ms
90,696 KB |
testcase_26 | AC | 3,422 ms
210,416 KB |
testcase_27 | AC | 145 ms
83,468 KB |
testcase_28 | AC | 3,363 ms
220,308 KB |
testcase_29 | AC | 3,330 ms
220,512 KB |
testcase_30 | AC | 3,292 ms
220,376 KB |
testcase_31 | AC | 3,356 ms
220,432 KB |
testcase_32 | AC | 3,335 ms
220,580 KB |
testcase_33 | AC | 206 ms
88,376 KB |
testcase_34 | AC | 162 ms
87,188 KB |
testcase_35 | AC | 952 ms
118,264 KB |
testcase_36 | AC | 50 ms
66,764 KB |
testcase_37 | AC | 219 ms
79,416 KB |
testcase_38 | AC | 69 ms
71,396 KB |
testcase_39 | AC | 3,371 ms
220,364 KB |
testcase_40 | AC | 3,330 ms
220,524 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(1<<n): if S & t: cnt[S^t] += cnt[S] #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(1<<n): if S & t: cnt[S] += cnt[S^t] 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")