Still want to spend a half a day not to understand. I don't know how to do it, so I can't get in touch.
Binary graph minimum point coverage = Two The matching number of the graph see the hihocoder of a week
1#include <iostream>2#include <cstdio>3#include <cstdlib>4#include <cstring>5#include <string>6#include <queue>7#include <algorithm>8#include <map>9#include <iomanip>Ten#include <climits> One#include <string.h> A#include <cmath> -#include <stdlib.h> -#include <vector> the#include <Set> - #defineINF 1e7 - #defineMAXN 100010 - #defineMAXN 50 + #defineMAXM 1000 - #defineMod 1000007 + using namespacestd; AtypedefLong LongLL; at - - intT; - intu, v; - intN, M; - intans; invector<int> g[555]; - intvis[10010]; to intmatch[10010]; + - BOOLPathintu) the { * for(inti =0; I < g[u].size (); ++i) { $ intv =G[u][i];Panax Notoginseng if(true= = Vis[v])Continue; -VIS[V] =true; the if(Match[v] = =-1||path (Match[v])) { +MATCH[V] =u; A return true; the } + } - return false; $ } $ - voidHungarian () - { theAns =0; -memset (match,-1,sizeof(Match));Wuyi for(inti =1; I <= N; ++i) { thememset (Vis,0,sizeof(Vis)); - if(Path (i)) ans++; Wu } - } About $ voidRun () - { -scanf"%d%d",&n,&m); - for(inti =0; I <= N; ++i) { A g[i].clear (); + } the for(inti =0; I < m; ++i) { -scanf"%d%d",&u,&v); $ G[u].push_back (v); the } the Hungarian (); theprintf"%d\n", ans); the - } in intMain () the { thescanf"%d", &T); About while(t--) the run (); the return 0; the}
Nyoj Game Master's annoyance (two-figure minimum point overlay)