poj 1469
来源:互联网 发布:毕业设计查重软件 编辑:程序博客网 时间:2024/05/22 18:27
#include<iostream>#include<stdio.h>#include<string.h>#include<limits.h>#define MAX 302int p,n;bool map[MAX][MAX];bool visit[MAX];int match[MAX];bool find(int k){ int i,j; for(i=1;i<=n;i++) { if(map[k][i]&&visit[i]==false) { visit[i]=true; if(match[i]==0||find(match[i])) { match[i]=k; return true; } } } return false;}int hungary(){ memset(match,0,sizeof(match)); int sum=0; for(int i=1;i<=p;i++) { memset(visit,0,sizeof(visit)); if(find(i)) sum++; } return sum;}int main(){ int t,i,j,k; scanf("%d",&t); while(t--) { memset(map,0,sizeof(map)); scanf("%d%d",&p,&n); for(i=1;i<=p;i++) { scanf("%d",&j); while(j--) { scanf("%d",&k); map[i][k]=true; } } if(hungary()==p) printf("YES\n"); else printf("NO\n"); }}
匈牙利算法
- poj 1469
- poj-1469
- poj 1469
- POJ 1469
- POJ 1469
- poj 1469
- POJ 1274 / POJ 1469 / POJ 2239 二分图最大匹配
- poj 2446 poj 1469 poj 1274 二分图最大匹配
- POJ 1469 courses
- POJ-1469 COURSES
- poj 1469(匈牙利算法)
- POJ 1469 COURSES
- poj 1469 && hdu1083 COURSES
- POJ 1469 匈牙利算法
- POJ 1469 COURSES
- poj(1469)COURSES
- POJ-1469-COURSES
- poj 1469
- perl应用:DNA序列酶切图谱的创建
- 整理笔记。记的有点乱。
- TextView属性大全
- linux下配置jdk环境变量
- Xfire soapHeader的WebService权限控制forjava
- poj 1469
- Android开发EditText属性
- 对互联网海量数据实时计算的理解
- c/c++混合编程简明总结
- 360逆袭百度 搜索纷争再起
- grub引导系统
- TYVJ-1057 DP
- \Home\bin\dbtest.apk installed on device
- 安装GRUB到U盘