hdu 2063 过山车
来源:互联网 发布:淘宝所谓磨损的化妆品 编辑:程序博客网 时间:2024/05/16 14:14
acm.hdu.edu.cn/showproblem.php?pid=2063
二分图最大匹配
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;const int V = 510;const int E = 1010;int k,n,m,G[V][V];int check[V],ma[V],mb[V];int DFS(int u){ for(int i=1; i<=m; i++){ if(!check[i] && G[u][i] > 0){ check[i] = 1; if(mb[i] == -1 || DFS(mb[i])){ ma[u] = i; mb[i] = u; return 1; } } } return 0;}void MMC(){ int res = 0; memset(mb, -1, sizeof(mb)); memset(ma, -1, sizeof(ma)); for(int i=1; i<=n; i++){ memset(check, 0, sizeof(check)); res += DFS(i); } printf("%d\n",res);}int main(){ while(scanf("%d%d%d",&k,&n,&m) == 3){ if(!k) break; memset(G, 0, sizeof(G)); for(int i=0; i<k; i++){ int a,b; scanf("%d%d",&a,&b); G[a][b] = 1; } MMC(); } return 0;}
0 0
- hdu 2063 过山车
- hdu 2063 过山车
- HDU-2063 过山车
- HDU 2063 过山车
- HDU 2063 过山车
- hdu 2063 过山车
- HDU 2063 过山车
- HDU 2063 过山车
- hdu 2063 过山车
- hdu 2063 过山车
- hdu 2063 过山车
- HDU 2063 过山车
- HDU 2063 过山车
- hdu 2063 过山车
- HDU 2063 过山车
- hdu 2063(过山车)
- hdu 2063 过山车
- hdu 2063 过山车
- 计算像素轮廓的像素面积算法
- iOS 调用地图导航
- [C++]LeetCode: 82 Fraction to Recurring Decimal
- C# Winform AcceptButton的使用
- 2015 互联网面试问题总结
- hdu 2063 过山车
- 独立思考
- 开源软件许可协议简介
- Apache 配置------FastCGI方式使用PHP(包含:linux下编译安装fmod_fcgid,配置apache以支持FastCGI)
- 强制类型的转换
- 第四章 Controller接口控制器详解(1)——跟着开涛学SpringMVC
- Android Eclipse ADT离线包下载
- git忽略一些文件或文件夹不加入版本控制
- mysql 建立索引