匈牙利算法匹配二分图(渣男算法)思路:遍历左边集合的每个点, 左侧点a1所连的右侧的点b1,如果右侧点b1已被匹配,看和他匹配的左侧点a2, 看能否从新给a2匹配一个没有匹配的点b2,如果可以就让a2和b2匹配,让a1和b1匹配,如果b1原本就没有匹配的点,就直接让a1和b1匹配,最终输出匹配的数量
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 510, M = 1e5 + 10;
int h[N], e[M], ne[M], idx;
int match[N];