hdu3006之位压缩
来源:互联网 发布:2015年淘宝网店数量 编辑:程序博客网 时间:2024/05/16 07:19
The Number of set
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1002 Accepted Submission(s): 626
Problem Description
Given you n sets.All positive integers in sets are not less than 1 and not greater than m.If use these sets to combinate the new set,how many different new set you can get.The given sets can not be broken.
Input
There are several cases.For each case,the first line contains two positive integer n and m(1<=n<=100,1<=m<=14).Then the following n lines describe the n sets.These lines each contains k+1 positive integer,the first which is k,then k integers are given. The input is end by EOF.
Output
For each case,the output contain only one integer,the number of the different sets you get.
Sample Input
4 41 11 21 31 42 43 1 2 34 1 2 3 4
Sample Output
152
#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<string>#include<queue>#include<algorithm>#include<map>#include<iomanip>#define INF 99999999using namespace std;const int MAX=1<<15;bool mark[MAX];int s[MAX];int main(){int n,m,k,a;while(cin>>n>>m){m=1<<(m+1);memset(s,0,sizeof s);memset(mark,false,sizeof mark);mark[0]=true;for(int i=0;i<n;++i){cin>>k;while(k--){cin>>a;s[i]=s[i]|(1<<a);}for(int j=0;j<m;++j){if(mark[j])mark[s[i]|j]=true;}}int num=0;for(int j=1;j<m;++j)num+=mark[j];cout<<num<<endl;}return 0;}
- hdu3006之位压缩
- hdu3006 状态压缩+位运算+hash(小想法题)
- hdu3006状态压缩
- hdu3006 状态压缩~方案数
- hdu3006
- hdu3006
- 位压缩
- 位压缩
- hdu3006状态dp
- POJ1753位压缩BFS
- poj1753 位压缩+bfs
- poj2965 位压缩+dfs
- 位运算状态压缩
- HDU3006-The Number of se
- 位图和位块传输(2)压缩拉伸之StretchBlt函数
- JAVA之JDK在64位系统默认开启压缩指针分析
- 8位一组压缩字符串
- POJ1753(BFS+位压缩)
- 人人和企鹅的web登陆加密
- .NET领域驱动设计—看DDD是如何运用设计模式颠覆传统架构
- 中缀表达式转后缀表达式
- S3C2410 实验三——跑马灯实验
- UVALive 4048 Fund Management
- hdu3006之位压缩
- rqn 224 手机(常量数组)
- HDU1054Strategic Game(最小顶点覆盖数)
- android Fragment
- 分区表
- 写给新手程序员的一封信
- C++单实例——互斥对象
- OpenCV学习笔记:矩阵的掩码操作
- S3C2410 ADS实验手册