POJ-The Perfect Stall-最大图匹配
来源:互联网 发布:注册表清理软件 编辑:程序博客网 时间:2024/04/30 21:03
题目链接:http://poj.org/problem?id=1274
最大图匹配算法分析:http://blog.csdn.net/dark_scope/article/details/8880547
#include <stdio.h>#include <stdlib.h>#include <string.h>bool line[205][205];int link[205];bool vis[205];int m,n;bool find(int k){ int i,j; for (int i = 1; i <= n; ++i) //遍历每一个妹子 { if (line[k][i]&&!vis[i]) { vis[i]=true; if(link[i]==0||find(link[i])){ link[i]=k; return true; } } } return false;}int main(){ freopen("0input.txt","r",stdin); int t,p,ans; while(scanf("%d%d",&m,&n)!=EOF){ memset(line,0,sizeof(line)); memset(link,0,sizeof(link)); for (int i = 1; i <= m; ++i) { scanf("%d",&t); for (int j = 0; j < t; ++j) { scanf("%d",&p); line[i][p]=1; } } ans =0; for (int i = 1; i <= m; ++i) { memset(vis,0,sizeof(vis)); if (find(i)) ans++; } printf("%d\n",ans); } return 0;}
0 0
- POJ-The Perfect Stall-最大图匹配
- 【POJ】1274 The Perfect Stall 二分匹配
- POJ 1274 The Perfect Stall 最大匹配
- Poj 1274 The Perfect Stall【二分匹配】
- poj The Perfect Stall
- The Perfect Stall POJ
- POJ 1274 The Perfect Stall(最大二分匹配)
- POJ 1274 The Perfect Stall 二分图最大匹配
- 二分图匹配(简单题)POJ 1274 The Perfect Stall
- 二分图最大基数匹配 POJ 1274 The Perfect Stall
- POJ 1274 The Perfect Stall(二分图最大匹配)
- 【二分图+最大匹配】北大 poj 1274 The Perfect Stall
- poj 匈牙利二分匹配 1274 The Perfect Stall
- POJ 1274 The Perfect Stall(二分匹配)
- POJ 1274 The Perfect Stall 【二分图匹配】
- POJ 1274 The Perfect Stall(二分匹配)- from lanshui_Yang
- poj 1274 The Perfect Stall (二分图匹配)
- Poj 1274 The Perfect Stall[二分图最大匹配]
- C++基础学习—string
- Objective-C @class与#import的区别
- 内存对齐规则和作用
- 局部全局变量、弹框、键盘退出、延展类、frame、transform
- EXE与SYS通信(其他模式)
- POJ-The Perfect Stall-最大图匹配
- 散列函数
- android工程引用另外一个工程的类和资源
- 房价预测(HackerRank)
- C11标准新特性
- 个人网站
- ListView侧滑删除(SwipeMenuListView)
- div css 背景颜色透明度设置
- 常用工具---前30的英文缩写