"Hdoj 1150" machine Schedule

Source: Internet
Author: User

"Hdoj 1150" machine Schedule

The minimum vertex coverage problem of binary graphs
Another problem in weak Bo: http://blog.csdn.net/challengerrumble/article/details/47099899

This topic has two lines a B
There are n machines in a, m in B
There are now K missions. Each task can be completed by a medium I or B in section J of each pipeline to change the machine will take 1 time to ask the minimum time
Each task is equivalent to an edge join two points figure two set each vertex the problem can be understood as finding the minimum number of vertices required to accommodate all edges (that is, the minimum vertex coverage problem for the two-minute graph)
The smallest vertex of a binary graph = maximum matching

The code is as follows:

#include <cstdio>#include <cstdlib>#include <cstring>using namespace STD;BOOLmp[111][111],vis[111];intlink[111],n,m;BOOLCanintP) {intI for(i =1; I <= m; ++i) {if(!vis[i] && mp[p][i]) {Vis[i] =true;if(Link[i] = =-1|| Can (Link[i])) {link[i] = p;return 1; } Vis[i] =false; }    }return 0;}intMain () {intk,i,x,y,cnt; while(~scanf("%d", &n) && n) {cnt =0;memset(MP,0,sizeof(MP));scanf("%d%d", &m,&k); while(k--) {scanf(" %d%d%d", &i,&x,&y); Mp[x][y] =true; }memset(link,-1,sizeof(link)); for(i =1; I <= N; ++i) {memset(Vis,0,sizeof(VIS));if(Can (i)) cnt++; }printf("%d\n", CNT); }return 0;}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Hdoj 1150" machine Schedule

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.