HDU 1150 Machine Schedule hdu 1151 Air Raid Hungarian templates

Source: Internet
Author: User
Tags cas cmath

Two floods ... Oh, no, two concluding questions.

Conclusion: The minimum coverage number of two graphs = the maximum number of matches for two-part graphs

The minimum number of overlays for a graph = number of nodes-maximum matches of two graphs

1 //HDU 11502#include <cstdio>3#include <iostream>4#include <cmath>5#include <algorithm>6#include <cstring>7#include <cstdlib>8#include <queue>9#include <vector>Ten#include <map> One#include <stack> A#include <string> -  - using namespacestd; the  - intn,m,k; - intf[101][101]; - intlink[101]; + BOOLadj[101]; - BOOLused[101]; +  A BOOLWorkintx) { at      for(intI=1; i<m;i++){ -             if(F[x][i] && adj[i]==false){ -adj[i]=true; -                     if(!used[i] | |Work (Link[i])) { -link[i]=x; -used[i]=1; in                             //printf ("%d%d\n", x,i); -                             return true; to                     } +             } -     } the     return false; * } $ Panax Notoginseng intMain () { -      while(SCANF ("%d%d%d", &n,&m,&k) = =3){ theMemset (F,0,sizeof(f)); +memset (Used,0,sizeof(used)); A              for(intI=0; i<k;i++){ the                     intx, y, z +scanf"%d%d%d",&z,&x,&y); -                     if(x!=0&& y!=0){ $f[x][y]=1; $                     } -             } -             intans=0; the              for(intI=1; i<n;i++){ -memset (adj,0,sizeof(adj));Wuyi                     if(Work (i)) ans++; the             } -             //for (int i=1;i<m;i++) printf ("%d%d\n", I,link[i]); Wuprintf"%d\n", ans); -     } About     return 0; $ } - /* - 5 5 - 0 1 1 A 1 1 2 + 2 1 3 the 3 1 4 - 4 2 1 $ 5 2 2 the 6 2 3 the 7 2 4 the 8 3 3 the 9 4 3 - 5 5 in 0 1 1 the 1 1 2 the 2 1 3 About 3 1 4 the 4 2 1 the 5 2 2 the 6 2 3 + 7 2 4 - 8 3 3 the 9 4 3Bayi 0 the */
View Code
1 //HDU 11512#include <cstdio>3#include <iostream>4#include <cmath>5#include <algorithm>6#include <cstring>7#include <cstdlib>8#include <queue>9#include <vector>Ten#include <map> One#include <stack> A#include <string> -  - using namespacestd; the  - intT; - intn,m; - BOOLf[121][121]; + intlink[121]; - BOOLadj[121]; + BOOLused[121]; A  at BOOLWorkintx) { -      for(intI=1; i<=n;i++){ -             if(F[x][i] &&!Adj[i]) { -adj[i]=1; -                     if(!used[i] | |Work (i)) { -link[i]=x; inused[i]=1; -                             return true; to                     } +             } -     } the     return false; * } $ Panax Notoginseng intMain () { -scanf"%d",&T); the      for(intcas=1; cas<=t;cas++){ +memset (Used,0,sizeof(used)); Amemset (Link,0,sizeof(link)); theMemset (F,0,sizeof(f)); +scanf"%d",&n); -scanf"%d",&m); $              for(intI=0; i<m;i++){ $                     intx, y; -scanf"%d%d",&x,&y); -f[x][y]=1; the             } -             intans=N;Wuyi              for(intI=1; i<=n;i++){ thememset (adj,0,sizeof(adj)); -                     if(Work (i)) ans--; Wu             } -printf"%d\n", ans); About     } $     return 0; - } - /* - 2 A 4 + 3 the 3 4 - 1 3 $ 2 3 the 3 the 3 the 1 3 the 1 2 - 2 3 in */
View Code

HDU 1150 Machine Schedule hdu 1151 Air Raid Hungarian templates

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.