Original title Address
It mainly introduces two theorems:
1. Two the maximum number of matches = Two The minimum point coverage number of the graph
2. Two graph minimum point cover number = Two figure vertex number-two fractal minimum point cover number
Look, it's a two-part picture.
Code: (Hungarian algorithm)
1#include <iostream>2#include <cstring>3 4 using namespacestd;5 6 #defineMax_n 10247 #defineMax_m 163848 9 intN, M;Ten intF[max_n]; One intN[max_m]; A intU[max_m]; - intV[max_m]; - intM[max_n]; the BOOLC[max_n]; - - BOOLFindintp) { - for(inti = f[p]; I! =0; i =N[i]) { + if(C[v[i]]) - Continue; +C[v[i]] =true; A if(!m[v[i] | |find (M[v[i])) { atM[P] =V[i]; -M[v[i]] =p; - return true; - } - } - return false; in } - to intsolve () { + intres =0; - for(inti =1; I <= N; i++) { theMemset (c,0,sizeof(c)); * if(!m[i] &&find (i)) $res++;Panax Notoginseng } - returnRes; the } + A intMain () { the +Memset (c,0,sizeof(c)); -Memset (M,0,sizeof(m)); $ $scanf"%d%d", &n, &M); - for(inti =0, j =0; i < M; i++) { - intA, B; thescanf"%d%d", &a, &b); -J + +;WuyiU[J] =A; theV[J] =b; -N[J] =F[a]; WuF[a] =J; -J + +; AboutU[J] =b; $V[J] =A; -N[J] =F[b]; -F[B] =J; - } A + intx =solve (); theprintf"%d\n%d\n", X, N-x); - $ return 0; the}
hihocoder#1127 binary Graph San Shi minimum point coverage and maximum independent set