POJ 2536 Gopher II】的更多相关文章

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…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1882 http://poj.org/problem?id=2536 题目大意: 有n之地鼠和m个地洞,他们需要在s秒内以v秒的速度跑进洞中,否则会被鹰抓走.给定每个地鼠和洞的坐标,每个洞最多容纳一只地鼠,问最小有危险的地鼠个数. 思路: 跑回学校了~来A几题. 几个月前看的题不会做T T,现在好简单... 本题可以转化为二分图匹配.如果地鼠到洞的时间小于s,那么久建一条边…
题目链接: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…
二分图的最大匹配 地鼠内部和地鼠洞内部都是没有边相连的,那么就可以看成一个二分图.地鼠如果可以跑到那个地鼠洞,就连一条边,然后跑二分图的最大匹配,最后地鼠的数量减去最大匹配数就是答案. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ; int nx,ny; int g[MAXN][MAXN]; int cx[MAXN],c…
题意: 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://poj.org/problem?id=2536 [算法] 匈牙利算法解二分图最大匹配 [代码] #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio&g…
Gopher II Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6675   Accepted: 2732 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…
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…
Gopher II Time Limit: 2000MS Memory Limit: 65536K 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 doe…
题目传送门 /* 匈牙利算法:这题比UVA_670简单,注意是要被吃的鼠的最少个数,套模板 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> using namespace std; ; const int INF = 0x3f3f3f3f; struct P { double x, y; }a[MAXN]…