Title: Finding the largest complete binary diagram in a binary graph
Theorem: Maximal group of binary graphs = maximal independent set of its complement graph
/************************************************author:D arktongcreated time:2016/7/31 15:17:40File Name: poj_3296.cpp*************************************************/#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<vector>#include<queue>#include<Set>#include<map>#include<string>#include<cmath>#include<cstdlib>#include<ctime>#defineINF 0x3f3f3f3f#defineESP 1e-9typedefLong LongLL;using namespacestd;Const intMAXN = $+Ten;intW[MAXN][MAXN], LEFT[MAXN], N, m;BOOLUSED[MAXN];BOOLMatchintj) { for(intI=1; i<=n;++i)if(w[i][j]&&!Used[i]) {Used[i]=true; if(! left[i]| |match (Left[i])) {Left[i]=J; return true; } } return false;}intHungary () {intres=0; Memset (left,0,sizeof(left)); for(intI=1; i<=m;++i) {memset (used,0,sizeof(used)); if(Match (i)) res++; } returnRes;}intMain () {//freopen ("In.txt", "R", stdin); //freopen ("OUT.txt", "w", stdout); intK, cas=1; while(SCANF ("%d%d%d", &n, &m, &k) = =3&& (n+m+k)) {intu, v; for(intI=1; i<=n;++i) for(intj=1; j<=m;++j) {if(I==J) w[i][j]=0; Elsew[i][j]=1; } for(intI=1; i<=k;++i) {scanf ("%d%d", &u, &v); W[U][V]=0; } intAns =Hungary (); Ans= n+m-ans; printf ("Case %d:%d\n", cas++, ans); } return 0;}
poj_3692 Kindergarten-Two the largest group of graphs