Topic links
Bare binary Graph matching (why do I have to do this kind of water problem?) I'm too weak. Qaq)
1#include <algorithm>2#include <iostream>3#include <cstdlib>4#include <cstring>5#include <cstdio>6#include <string>7#include <cmath>8#include <ctime>9#include <queue>Ten#include <stack> One#include <map> A#include <Set> - #defineRre (i,r,l) for (int i= (r); i>= (l); i--) - #defineRe (I,L,R) for (int i= (l); i<= (R); i++) the #defineClear (A, B) memset (A,b,sizeof (a)) - #defineInOut (x) printf ("%d", (x)) - #defineDouin (x) scanf ("%lf", &x) - #defineStrin (x) scanf ("%s", (x)) + #defineLLin (x) scanf ("%lld", &x) - #defineOP operator + #defineCSC Main Atypedef unsignedLong LongULL; attypedefConst intCInt; -typedefLong LongLL; - using namespacestd; - voidInin (int&ret) - { -ret=0;intf=0;CharCh=GetChar (); in while(ch<'0'|| Ch>'9'){if(ch=='-') f=1; ch=GetChar ();} - while(ch>='0'&&ch<='9') ret*=Ten, ret+=ch-'0', ch=GetChar (); toret=f?-Ret:ret; + } - intt,n,pre[222],a[222][222],head[222],next[40040],zhi[40040],ed,bo[222]; the voidAddintAintb) * { $next[++ed]=head[a],head[a]=ed,zhi[ed]=b;Panax Notoginseng } - BOOLFindintXintt) the { + for(intI=head[x];i;i=next[i])if(bo[zhi[i]]!=t) A { thebo[zhi[i]]=T; + if(!pre[zhi[i]]| |find (pre[zhi[i]],t)) - { $pre[zhi[i]]=x; $ return 1; - } - } the return 0; - }Wuyi intMain () the { - Inin (t); Wu while(t--) - { AboutInin (n); Clear (PRE,0), Clear (head,0); ed=0; Clear (Bo,0); $Re (I,1, N) Re (J,1, N) - { - Inin (A[i][j]); - if(a[i][j]==1) Add (i,j); A } + intans=0; theRe (I,1, N)if(Find (i,i)) ans++; - if(Ans==n) puts ("Yes"); $ ElsePuts"No"); the } the return 0; the}
bzoj1059 [ZJOI2007] Matrix game