poj 2112(二分+多重匹配)】的更多相关文章

题目链接:http://poj.org/problem?id=2112 思路:由于要求奶牛走的最远距离的最短路程,显然我们可以二分距离,如果奶牛与挤奶器的距离小于等于limit的情况下,能够满足,则在(low,limit-1)中继续二分,否则在(limit+1,high)中寻找,那满足的条件就是根据题目的条件每头奶牛都能找到挤奶器,由于每个挤奶器可以最多挤M头奶牛,因此要求多重匹配. 注意点:一开始要Floyd预处理出每头奶牛到挤奶器的最短距离. http://paste.ubuntu.com/…
POJ 2289(多重匹配+二分) 把n个人,分到m个组中.题目给出每一个人可以被分到的那些组.要求分配完毕后,最大的那一个组的人数最小. 用二分查找来枚举. #include<iostream> #include<string> #include<cstring> #include<cstdio> using namespace std; int map[1010][510]; int vis[1010]; int link[1010][510]; int…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1669 思路:由于要求minimize the size of the largest group,由此我们想到二分枚举,然后每一次求一下多重匹配就可以了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using n…
题目链接:http://poj.org/problem?id=3189 思路:由于题目要求最小的差值,而Range最多也才20,因此我们可以枚举上下限,多重匹配验证即可. http://paste.ubuntu.com/5943733/…
  Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 19347   Accepted: 6907 Case Time Limit: 1000MS issions: 19347   Accepted: 6907 Case Time Limit: 1000MS Description FJ has moved his K (1 <= K <= 30) milking machines out…
Jamie's Contact Groups Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 9227   Accepted: 3180 Description Jamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The con…
Jamie's Contact Groups Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 8567   Accepted: 2900 Description Jamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The con…
Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 17297   Accepted: 6203 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: 15749   Accepted: 5617 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…
Battle ships Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 39    Accepted Submission(s): 19 Problem Description Dear contestant, now you are an excellent navy commander, who is responsible of…