Gopher II Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6345   Accepted: 2599 Description The gopher family, having averted the canine threat, must face a new predator. The are n gophers and m gopher holes, each at distinct (x, y) coor…
二分图的最大匹配 地鼠内部和地鼠洞内部都是没有边相连的,那么就可以看成一个二分图.地鼠如果可以跑到那个地鼠洞,就连一条边,然后跑二分图的最大匹配,最后地鼠的数量减去最大匹配数就是答案. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ; int nx,ny; int g[MAXN][MAXN]; int cx[MAXN],c…
题目链接:http://poj.org/problem?id=2536 题意:已知有n仅仅老鼠的坐标,m个洞的坐标,老鼠的移动速度为V,S秒以后有一仅仅老鹰要吃老鼠,问有多少个老鼠被吃. 非常明晰,二分匹配,老鼠为X集合,洞为Y集合 思路:计算当前老鼠 Xi 到达洞 Yi 的时间(dis/v),假设小于S的话,则Xi与Yi联通, 被吃的老鼠数 = n - 最大匹配数 #include <iostream> #include <cstdio> #include <cstdlib…
题意: N只地鼠M个洞,每只地鼠.每个洞都有一个坐标. 每只地鼠速度一样,对于每只地鼠而言,如果它跑到某一个洞的所花的时间小于等于S,它才不会被老鹰吃掉. 规定每个洞最多只能藏一只地鼠. 问最少有多少只地鼠会命丧鹰口. 思路: 直接建图.二分图最大匹配. 代码: char st[105]; char Range[25][5]; int n; int num[10]; int cx[25],cy[205]; bool bmask[205]; vector<int> graph[25]; int…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1882 http://poj.org/problem?id=2536 题目大意: 有n之地鼠和m个地洞,他们需要在s秒内以v秒的速度跑进洞中,否则会被鹰抓走.给定每个地鼠和洞的坐标,每个洞最多容纳一只地鼠,问最小有危险的地鼠个数. 思路: 跑回学校了~来A几题. 几个月前看的题不会做T T,现在好简单... 本题可以转化为二分图匹配.如果地鼠到洞的时间小于s,那么久建一条边…
Gopher II Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9005   Accepted: 3724 Description The gopher family, having averted the canine threat, must face a new predator. The are n gophers and m gopher holes, each at distinct (x, y) coor…
题意 现在要将5种型号的衣服分发给n个参赛者,然后给出每个参赛者所需要的衣服的尺码的大小范围,在该尺码范围内的衣服该选手可以接受,再给出这5种型号衣服各自的数量,问是否存在一种分配方案使得每个选手都能够拿到自己尺码范围内的衣服. 思路 明显的二分图多重最大匹配问题:每个点能匹配的边不再限制1个,而是多个. 做法:最大流.虽说也有对应的匈牙利算法,但是我还是图省事用最大流做了. 建图:源点连接每个型号的衣服,容量为能够匹配的个数(数量),汇点连接每个队员,容量也为能够匹配的个数(1),其他匹配边容…
The Perfect Stall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22539   Accepted: 10072 Description Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering p…
[题目链接] http://poj.org/problem?id=2536 [算法] 匈牙利算法解二分图最大匹配 [代码] #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio&g…
Description The gopher family, having averted the canine threat, must face a new predator. The are n gophers and m gopher holes, each at distinct (x, y) coordinates. A hawk arrives and if a gopher does not reach a hole in s seconds it is vulnerable t…