Nyoj Game Master's annoyance (two-figure minimum point overlay)

Source: Internet
Author: User

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)

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.