POJ 2239 二分最大匹配
来源:互联网 发布:sql 增加列 默认值 编辑:程序博客网 时间:2024/06/07 07:46
水题。
#include <iostream>#include <cstdio>#include <algorithm>#include <string>#include <cmath>#include <cstring>#include <queue>#include <set>#include <vector>#include <stack>#include <map>#include <iomanip>#define PI acos(-1.0)#define Max 2005#define inf 1<<28#define LL(x) (x<<1)#define RR(x) (x<<1|1)#define Rep(i,s,t) for(int i=(s);i<=(t);++i)#define ll long long#define mem(a,b) memset(a,b,sizeof(a))#define mp(a,b) make_pair(a,b)using namespace std;int Map[Max][Max] ;bool vis[Max] ;int link[Max] ;int m ;void init(){ mem(vis,0) ; mem(Map,0) ; mem(link,-1) ;}int dfs(int x){ for (int i = 1 ;i <= 200 ;i ++)//SB了,一开始这里i <= 100 ,WA出翔 12 * 12 + 7 居然算成<= 100 ,我给自己跪了 { if(Map[x][i] && !vis[i]) { vis[i] = 1 ; if(link[i] == -1 || dfs(link[i])) { link[i] = x ; return 1 ; } } } return 0 ;}int main(){ int n ; while(cin >> n ) { init() ; for (int i = 1 ; i <= n ;i ++ ) { cin >> m ; for (int j = 1 ;j <= m; j ++ ) { int a , b ; cin >> a >> b ; int num = b * 12 + a ; Map[i][num] = 1 ; } } int ans = 0 ; for (int i = 1 ; i <= n ;i ++ ) { mem(vis,0) ; ans += dfs(i) ; } cout << ans << endl; } return 0;}
- POJ 2239 二分最大匹配
- poj 2239 二分 最大匹配
- POJ 2239 二分图最大匹配
- POJ 2239 二分图最大匹配模版
- POJ 1274 / POJ 1469 / POJ 2239 二分图最大匹配
- POJ 2446 二分最大匹配
- poj 3020 二分最大匹配
- POJ 3057 最大二分匹配+bfs + 二分
- POJ 2239 —— 二分图最大匹配
- poj 2239 Selecting Courses 二分图最大匹配数
- poj 2239 Selecting Courses 二分图最大匹配
- Poj 2239 Selecting Courses 二分图最大匹配
- POJ 2239 Selecting Courses(二分图最大匹配)
- POJ 2239 Selecting Courses(二分图最大匹配)
- poj 2239 Selecting Courses 二分图最大匹配
- POJ 2239-Selecting Courses(二分图_最大匹配+哈希建图)
- poj 2239 Selecting Courses 【二分图最大匹配】
- POJ - 2239 Selecting Courses 二分图 最大匹配
- (android实战总结)IO存储总结
- UVA10080 Gopher II
- SQL注入攻防入门详解
- 三天打渔两天晒网 C程序实现
- 微博开发
- POJ 2239 二分最大匹配
- ASP.NET性能提升秘诀之管道与进程优化
- ucosii在stm32上的移植详解
- hdu 3488 Tour (KM)
- SQL Server索引进阶第八篇:唯一索引
- JDBC以及相关技术学习(十)----拦截Connection的close方法
- 分析TCP/IP协议栈代码之ARP(STM32平台)
- mongodb 安装与启动
- Android任务与返回堆栈 (Tasks and Back Stack)