結果

問題 No.2669 Generalized Hitting Set
ユーザー 沙耶花沙耶花
提出日時 2024-03-08 23:57:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,315 bytes
コンパイル時間 4,256 ms
コンパイル使用メモリ 263,888 KB
実行使用メモリ 70,036 KB
最終ジャッジ日時 2024-03-08 23:57:38
合計ジャッジ時間 26,966 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 260 ms
6,548 KB
testcase_04 AC 213 ms
6,676 KB
testcase_05 AC 176 ms
6,676 KB
testcase_06 AC 318 ms
6,676 KB
testcase_07 AC 45 ms
6,676 KB
testcase_08 AC 68 ms
6,676 KB
testcase_09 AC 199 ms
6,676 KB
testcase_10 AC 108 ms
6,676 KB
testcase_11 AC 48 ms
6,676 KB
testcase_12 AC 242 ms
6,676 KB
testcase_13 AC 1,059 ms
68,976 KB
testcase_14 AC 116 ms
12,256 KB
testcase_15 AC 3 ms
6,676 KB
testcase_16 AC 28 ms
6,676 KB
testcase_17 AC 117 ms
12,260 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 16 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 28 ms
6,676 KB
testcase_22 AC 8 ms
6,676 KB
testcase_23 AC 389 ms
6,676 KB
testcase_24 AC 264 ms
6,676 KB
testcase_25 AC 384 ms
6,884 KB
testcase_26 RE -
testcase_27 AC 188 ms
6,676 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 362 ms
6,900 KB
testcase_34 AC 343 ms
6,676 KB
testcase_35 AC 547 ms
21,092 KB
testcase_36 AC 3 ms
6,676 KB
testcase_37 AC 54 ms
8,164 KB
testcase_38 AC 5 ms
6,676 KB
testcase_39 RE -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
long long comb[22][22];
int dp[1<<24];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	comb[0][0] = 1;
	for(int i=1;i<=20;i++){
		for(int j=0;j<=i;j++){
			if(j!=0)comb[i][j] += comb[i-1][j-1];
			comb[i][j] += comb[i-1][j];
		}
	}
	
	int n,m,k;
	cin>>n>>m>>k;
	vector<long long> kei(n+1);
	kei[k] = 1;
	for(int i=k+1;i<=n;i++){
		for(int j=k;j<i;j++){
			kei[i] += comb[i][j] * kei[j];
		}
		kei[i] = 1-kei[i];
	}
	
	rep(i,m){
		string s;
		cin>>s;
		int ii = 0;
		rep(j,n){
			if(s[j]=='1')ii |= 1<<j;
		}
		dp[ii]++;
	}
	rep(i,n){
		rep(j,1<<n){
			if((j>>i)&1){
				
			}
			else{
				dp[j] += dp[j^(1<<i)];
			}
			
		}
	}
	rep(i,1<<n)dp[i] *= kei[__builtin_popcount(i)];

	rep(i,n){
		rep(j,1<<n){
			if((j>>i)&1){
				
			}
			else{
				dp[j^(1<<i)] += dp[j];
			}
			
		}
	}
	
	
	vector<int> ans(m+1,Inf32);
	rep(i,1<<n){
		//if(dp[i]<0)cout<<i<<' '<<dp[i]<<endl;
		int t = __builtin_popcount(i);
		ans[dp[i]] = min(ans[dp[i]],t);
	}
	for(int i=m;i>=1;i--)ans[i-1] = min(ans[i-1],ans[i]);
	rep(i,m){
		cout<<ans[i+1]<<endl;
	}
	
	
	return 0;
}
0