http://poj.org/problem?id=2112 题意: 有K个挤奶器,C头奶牛,每个挤奶器最多能给M头奶牛挤奶. 每个挤奶器和奶牛之间都有一定距离. 求使C头奶牛头奶牛需要走的路程的最大路程最小. 分析:看到“最大的最小”这种字眼多半是二分枚举,容易想到二分枚举最小的最大路程,设其为max,那么接下来就是判定max合不合法了.故先把那些小于等于max的边加入二分图,如果这个二分图的多重匹配最多能匹配的数量恰恰等于奶牛数,那么说明所有奶牛都能挤到奶,即max合法,反之不合法. 步骤:…
[题意]有K台挤奶机,C头奶牛,在奶牛和机器间有一组长度不同的路,每台机器每天最多能为M头奶牛挤奶.现在要寻找一个方案,安排每头奶牛到某台机器挤奶,使得C头奶牛中走过的路径长度的和的最大值最小. 挺好的一道题~也算是经典的模型,里面所用到的方法也很经典.常用. [思路]易知模型其实是个二分图,只是每头奶牛可以去多台机器,所以二分图多重匹配就可以解,因为在练最大流,就拿最大流解了. 先Floyd预处理两两之间的最短距离,然后二分距离,每次以二分的mid为容量限制建图,即保留图中长度<=mid的边,…
Steady Cow Assignment Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7482   Accepted: 2572 题目链接:http://poj.org/problem?id=3189 Description: Farmer John's N (1 <= N <= 1000) cows each reside in one of B (1 <= B <= 20) barns which,…
题目链接: Poj 2289 Jamie's Contact Groups 题目描述: 给出n个人的名单和每个人可以被分到的组,问将n个人分到m个组内,并且人数最多的组人数要尽量少,问人数最多的组有多少人? 解题思路: 二分图多重匹配相对于二分匹配来说不再是节点间的一一对应,而是Xi可以对应多个Yi.所以我们就需要一个限制(Xi最多匹配几个Yi).当Yi需要匹配Xi的时候,Xi的匹配未到上限,直接匹配,否则进行增广路.其实是二分图多重匹配的模板题,再套一个二分枚举最多组的人数就OK咯.下面就上板…
Jamie's Contact Groups Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others) 题目链接:http://poj.org/problem?id=2289 Description: Jamie is a very popular girl and has quite a lot of friends, so she always keeps a very long…
题目大意: 有k个挤奶器,在牧场里有c头奶牛,每个挤奶器可以满足m个奶牛,奶牛和挤奶器都可以看成是实体,现在给出两个实体之间的距离,如果没有路径相连,则为0,现在问你在所有方案里面,这c头奶牛需要走的最大距离的最小值. 分析: 先将题目给出来的距离矩阵跑一下 Floyd 求出全源最短路方便后面建图, 这里注意一下除了对角线的点若有其他点为 0 则应将其值设置为 INF 代表不可达 在使用最大流判断是否存在解的时候,要对每个解都重新建图. 建图需要一个超级源点,把所有的奶牛与源点相连,容量设置为1…
Jamie's Contact Groups Time Limit: 15000/7000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 747    Accepted Submission(s): 303 Problem Description Jamie is a very popular girl and has quite a lot of friends, so she…
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…
题目链接: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: 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…