Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 722 Accepted Submission(s): 437
//这题很神奇的算法、呵呵
#include <iostream>
#include <stdio.h>
#include <string.h>
#define Y 1<<15
using namespace std;
bool a[Y+1];
int main()
{
int n,m,in;
int i,k,t,tin;
while(scanf("%d%d",&n,&m)!=EOF)
{
t=1<<(m+1);
for(i=1;i<=t;i++)
a[i]=0;
for(i=1;i<=n;i++)
{
scanf("%d",&k);
tin=0;
while(k--)
{
scanf("%d",&in);
tin+=1<<in;
}
a[tin]=1;
for(k=1;k<=t;k++)
if(a[k])
a[k|tin]=1;
}
k=0;
for(i=1;i<=t;i++)
if(a[i])
k++;
printf("%d\n",k);
}
return 0;
}