标签:
Description
Input
Output
Sample Input
Sample Output
#include<iostream> #include<cstring> #include<cmath> #include<cstdlib> #include<string> #include<cmath> #include<cstdio> #include<algorithm> #include<queue> #include<vector> #include<stack> #include<set> using namespace std; int n,m,dp[(1<<14)+10]; int main() { int x,temp; while(scanf("%d%d",&n,&m)!=EOF) { int ans=0; memset(dp,0,sizeof(dp)); while(n--) { scanf("%d",&x); int ret=0; for(int i=1;i<=x;i++) { scanf("%d",&temp); ret=ret|(1<<(temp-1)); } dp[ret]=1; for(int i=0;i<(1<<m);i++) { if(dp[i]) dp[(ret|i)]=1; } } for(int i=0;i<(1<<m);i++) if(dp[i]) ans++; printf("%d\n",ans); } return 0; }
标签:
原文地址:http://www.cnblogs.com/a972290869/p/4434242.html