POJ 1274 The Perfect Stall
来源:互联网 发布:淘宝店铺招牌怎么制作 编辑:程序博客网 时间:2024/04/28 07:33
POJ 1274 The Perfect Stall
二分图匹配的水题,和上一篇一样水过。。。当练练手吧
直接上代码
#include <stdio.h>#include <string.h>int n, m;int map[205][205];int vis[205];int zg[205];int i, j;int barn_num;int cow;int xi(int n){int i;for (i = 1; i <= m; i ++){if (vis[i] == 0 && map[n][i] == 1){vis[i] = 1;if (zg[i] == -1 || xi(zg[i])){zg[i] = n;return 1;}}}return 0;}int main(){while (scanf("%d%d", &n, &m) != EOF){int num = 0;memset(map, 0, sizeof(map));memset(vis, 0, sizeof(vis));memset(zg, 0, sizeof(zg));for (i = 1; i <= m ; i ++)zg[i] = -1;for (i = 1; i <= n; i ++){scanf("%d", &barn_num);while (barn_num -- ){scanf("%d", &cow);map[i][cow] = 1;}}for (i = 1; i <= n; i ++){memset(vis, 0, sizeof(vis));if (xi(i)){num ++;}}printf("%d\n", num);}return 0;}
- 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
- POJ 1274 The Perfect Stall
- poj 1274The 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
- Nginx工作原理和优化
- 对一个memcache的封装
- 解决sudo timestamp too far in the future
- DOM、JDOM、DOM4J的区别
- matplotlib画图(4)
- POJ 1274 The Perfect Stall
- C++ strcpy 函数的实现
- 使用独立PID namespace防止误杀进程
- Eclipse用法和技巧十九:eclipse修改workspace
- hdu2993 MAX Average Problem(斜率+单调队列)
- 修改oracle密码
- 大学毕业之后一个月该办理的手续
- Install Chromium (with Pepper Flash) on CentOS/Red Hat (RHEL) 6.4
- dup与dup2函数介绍