Codeforcesgym 100753B Bounty Hunter II

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.