"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