题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1150 很经典的二分题目 就是求最小点覆盖集 二分图最小点覆盖集=最大匹配数 代码: #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #define maxn 110 using namespace std; int ans; int n; int m; int k;…
//A组n人 B组m人 //最多有多少人匹配 每人仅仅有匹配一次 # include<stdio.h> # include<string.h> # include<algorithm> using namespace std; int n,m,k; int pp[1100][1100],map[1100],vis[1100]; int bfs(int x)//二分匹配模板 { for(int i=1;i<=m;i++)//B组中的人来迎合匹配 { if(!vis[…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1150 Machine Schedule Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6733    Accepted Submission(s): 3375 Problem Description As we all know, mach…
Machine Schedule Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5371    Accepted Submission(s): 2658 Problem Description As we all know, machine scheduling is a very classical problem in compu…
二分图:https://blog.csdn.net/c20180630/article/details/70175814 https://blog.csdn.net/flynn_curry/article/details/52966283 匈牙利算法模板:https://blog.csdn.net/sunny_hun/article/details/80627351 例题:hdu 1150 Machine Schedule 参考:https://www.cnblogs.com/qq-star/p…
题意:有两台机器A和B,A有n种工作模式(0~n-1),B有m种工作模式(0~m-1),两台机器的初始状态都是在工作模式0处.现在有k(0~k-1)个工作,(i,x,y)表示编号为i的工作可以通过机器A的工作模式x完成,也可以通过机器B的工作模式y完成.机器必须重启后才能更换一种工作模式,问最少的重启次数. 分析: 1.重启次数最少,即工作模式种类最少,即用最少的工作模式完成所有工作. 2.将A的n种工作模式看做n个点,将B的m种工作模式看做m个点,即用最少的点(工作模式)覆盖所有的边(一条边代…
个人心得:二分图啥的一点都不知道,上网借鉴了下,请参考http://blog.csdn.net/thundermrbird/article/details/52231639 加上自己的了解,二分图就是将图形拆分成俩半,俩边的点通过边界相连接.匹配就是不存在俩条边存在同一顶点,就是一个顶点最多连接一条边. 匈牙利算法就是用增广路进行更新,仔细一想确实如此,如果存在这样的途径那么必然可以用亦或就行维护更新,细节看参考. 不过碍于自己图论太low,还是无法运用的好,比如这题,就是最小覆盖点,关于最小覆…
As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that must be satisfied and the type of schedule desire…
匈牙利算法 目前为止还是半懂不懂的状态 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,m,k; ][];//邻接矩阵 ];//B集中访问标记 ];//B集中点i匹配的A中元素 int pd(int a){ int i,j; ;i<m;i++){ if(!vis[i] && mp[a][i]){ vis[i]=; || pd(link1…
机器的不同模式为点,对于每个job,建两条边 A机器需要的模式<->B机器需要的模式. 问题转化为最小点覆盖,然后用二分图的最小点覆盖==最大匹配,用匈牙利算法解. #include <cstdio> #include <cstring> const int N=105<<1; const int M=1001<<1; struct edge{ int to,next; }e[M]; int head[N],tot; void add(int u…