Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
34506 LYLAKIOI 【S】T3 C++ 通过 100 891 MS 126632 KB 1584 2024-11-10 14:39:38

Tests(10/10):


#include<bits/stdc++.h> #define up(i,l,r) for(int i=(l);i<=(r);++i) #define down(i,l,r) for(int i=(l);i>=(r);--i) #define pi pair<int,int> #define p1 first #define p2 second #define m_p make_pair #define p_b push_back using namespace std; typedef long long ll; const int maxn=2e5+10; inline ll read(){ ll x=0;short t=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); return x*t; } int n,m,k; int trans(){ int x=0;char ch=getchar(); while(ch<'0'||ch>'1')ch=getchar(); while(ch>='0'&&ch<='9')x=x*2+ch-'0',ch=getchar(); return x; } #define ppc __builtin_popcount int T[int(3e5)+10]; unsigned int f[1<<24],g[40],C[50][50]; void slv(){ n=read(),m=read(),k=read(); up(i,1,m){ int x=trans(); f[x]++; } up(i,0,n-1)up(j,0,(1<<n)-1)if(!((j>>i)&1))f[j]+=f[j+(1<<i)]; C[1][0]=C[1][1]=1; up(i,2,n){ up(j,0,n)C[i][j]=C[i-1][j]+(j?C[i-1][j-1]:0); } up(i,k,n){ g[i]=1; up(j,k,i-1)g[i]=g[i]-g[j]*C[i][j]; } up(i,0,(1<<n)-1)f[i]=f[i]*g[ppc(i)]; up(i,0,n-1)up(j,0,(1<<n)-1)if(!((j>>i)&1))f[j+(1<<i)]+=f[j]; //up(i,0,(1<<n)-1)printf("f[%d]=%d\n",i,f[i]); up(i,1,m)T[i]=1e9; up(i,1,(1<<n)-1)T[f[i]]=min(T[f[i]],ppc(i)); down(i,m-1,1)T[i]=min(T[i+1],T[i]); up(i,1,m)printf("%d\n",T[i]); } int main(){ //freopen("set.in","r",stdin); //freopen("set.out","w",stdout); slv(); fclose(stdin); fclose(stdout); return 0; }


测评信息: