Bounty Hunter iitime limit:5000msmemory limit:262144kbthis problem would be judged onCodeforcesgym. Original id:100753b
64-bit integer IO format: %i64d Java class name: (any) Problem solving: Minimum path coverage
1#include <bits/stdc++.h>2 using namespacestd;3 Const intMAXN =4010;4vector<int>G[MAXN];5 intLink[maxn],n;6 BOOLUSED[MAXN];7 BOOLMatchintu) {8 for(inti = g[u].size ()-1; I >=0; --i) {9 if(Used[g[u][i]])Continue;TenUsed[g[u][i]] =true; One if(Link[g[u][i]] = =-1||match (Link[g[u][i])) { ALink[g[u][i]] =u; - return true; - } the } - return false; - } - intMain () { + intm; - while(~SCANF ("%d",&N)) { + for(inti =0; i < MAXN; ++i) g[i].clear (); A for(inti =0; I < n; ++i) { atscanf"%d",&m); - for(intj =0, V; J < M; ++j) { -scanf"%d",&v); -G[i].push_back (v +n); - } - } inmemset (link,-1,sizeofLink); - intRET =0; to for(inti =0; I < n; ++i) { +memset (Used,false,sizeofused); - if(Match (i)) + +ret; the } *printf"%d\n"Nret); $ }Panax Notoginseng } - /* the 4 + 1 1 A 1 2 the 0 + 1 1 - $ 6 $ 0 - 1 2 - 2 4 5 the 1 2 - 0Wuyi 0 the - 5 Wu 1 4 - 1 4 About 1 4 $ 1 4 - 0 - */
View Code
Codeforcesgym 100753B Bounty Hunter II