POJ2112 Optimal Milking】的更多相关文章

题目链接:https://vjudge.net/problem/POJ-2112 Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 18555   Accepted: 6626 Case Time Limit: 1000MS Description FJ has moved his K (1 <= K <= 30) milking machines out into the cow past…
                                         Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 16461   Accepted: 5911 Case Time Limit: 1000MS Description FJ has moved his K (1 <= K <= 30) milking machines out into the cow past…
Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 17811   Accepted: 6368 Case Time Limit: 1000MS Description FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) co…
Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 12482   Accepted: 4508 Case Time Limit: 1000MS Description FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) co…
http://poj.org/problem?id=2112 题意: 有K个挤奶器,C头奶牛,每个挤奶器最多能给M头奶牛挤奶. 每个挤奶器和奶牛之间都有一定距离. 求使C头奶牛头奶牛需要走的路程的最大路程最小. 分析:看到“最大的最小”这种字眼多半是二分枚举,容易想到二分枚举最小的最大路程,设其为max,那么接下来就是判定max合不合法了.故先把那些小于等于max的边加入二分图,如果这个二分图的多重匹配最多能匹配的数量恰恰等于奶牛数,那么说明所有奶牛都能挤到奶,即max合法,反之不合法. 步骤:…
先Floyd求牛到机器最短距离,然后二分枚举最长的边. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; #define INF (1<<30) #define MAXN 233 #define MAXM 233*233*20 struct Edge{ int v,cap,flow,next; }edge[MAXM…
nx一个挤奶器,ny奶牛,每个挤奶罐为最m奶牛使用. 现在给nx+ny在矩阵之间的距离.要求使所有奶牛挤奶到挤奶正在旅程,最小的个体奶牛步行距离的最大值. 始感觉这个类似二分图匹配,不同之处在于挤奶器能够连接m个以内的奶牛,用网络流的模型是能够求出满足条件的解的. 问题是怎样满足最大路程的最小值,这一种典型的二分的问法.. 所以我们二分答案,也就是枚举最大路程,直到求得最小值. 每次建边既加入全部最大路程以内的边,加入源点向每一个挤奶器建边.容量为m.其它边都是1, 若返回的最大流是ny则该枚举…
题目大意: 有k个挤奶器,在牧场里有c头奶牛,每个挤奶器可以满足m个奶牛,奶牛和挤奶器都可以看成是实体,现在给出两个实体之间的距离,如果没有路径相连,则为0,现在问你在所有方案里面,这c头奶牛需要走的最大距离的最小值. 分析: 先将题目给出来的距离矩阵跑一下 Floyd 求出全源最短路方便后面建图, 这里注意一下除了对角线的点若有其他点为 0 则应将其值设置为 INF 代表不可达 在使用最大流判断是否存在解的时候,要对每个解都重新建图. 建图需要一个超级源点,把所有的奶牛与源点相连,容量设置为1…
Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 20262   Accepted: 7230 Case Time Limit: 1000MS Description: FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) c…
Optimal Milking Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 13968 Accepted: 5044 Case Time Limit: 1000MS Description FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) cows.…