Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=1068
#include <iostream> #include <stdio.h> #include <string.h>using namespace Std;int n;int used[505];int Link[505][505];int boy[505];int Find (int x) { int i; for (i=0;i<n;i++) { if (!used[i]&&link[x][i]) { used[i]=1; if (boy[i]==0| | Find (Boy[i])) { boy[i]=x; return true;}} } return false;} int main () { int all; int t,per,i,num; while (scanf ("%d", &n)!=eof) { memset (link,0,sizeof (link)); memset (boy,0,sizeof (Boy)); all=0; for (i=0;i<n;i++) { scanf ("%d: (%d)", &t,&num); while (num--) { scanf ("%d", &per); link[t][per]=1; } } for (i=0;i<n;i++) { memset (used,0,sizeof (used)); All+=find (i); } printf ("%d\n", N-ALL/2); } return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Maximum matching of HDU 1068 Girls and Boys binary graphs