#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
const int MAXN = 1002;
// 二分图匹配,返回最大的匹配数
// linker中保存匹配的关系 点从0开始
int g[MAXN][MAXN];
int n , m;
int linker[MAXN];
bool used[MAXN];
bool DFS ( int a )
{
for ( int i = 0 ; i < m; i ++ )
if (g[a][i] && !used[i] )
{
used[i] = true ;
if ( linker[i] == -1 || DFS( linker[i] ))
{
linker[i] = a;
return true;
}
}
return false;
}
int hungray ( )
{
int result = 0;
memset ( linker , -1 , sizeof ( linker )) ;
for ( int i = 0 ; i < n; i ++ )
{
memset ( used , 0 , sizeof ( used )) ;
if ( DFS ( i ) )
result ++;
}
return result;
}
// poj3041 把图看做成邻接矩阵就可以了 然后求二分图的最小点覆盖
// poj1325 将除0以外的点 构图 二分图的最小点覆盖
//注意这里面的点数从0开始的。