Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you never have such experiences, you would never know what fun treasure exploring brings to you.Recentl…
题意:给一个有向无环图,求出来最小路径覆盖,注意一个点可能会被多条路径重复 分析:因为有可能多条路径走一个点,可又能会造成匹配的不完全,所以先进行一次闭包传递(floyd),然后再用二分匹配的方法求出来最大匹配即可. *********************************************************************. #include<stdio.h> #include<; ; ; k<=N; k++)     ; i<=N; i++)…
1 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> #define N 505 using namespace std; int g[N][N]; int n, m; int vis[N], linker[N]; bool dfs(int u){ ; i<=n; ++i) if(g[u][i] && !vis[i]){ vis[i]=;…
因为是路  所以 如果 1——3  2——3    3——4   3——5 则 1——4  1——5  2——4   2——5 都是是合法的 又因为机器人是可以相遇的  所以 我们把所有的点 分别放在左边和右边 去匹配  就能实现 路的连通性 连通的路一个机器人就能遍历所有的点    没有路的点需要一个一个的机器人去找... 注意是 n - 最大匹配  不是2n #include<stdio.h> #include<string.h> #include<queue> #…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1429 思路:这道题还是比较麻烦的,对于求有向图的可相交的最小路径覆盖,首先要解决成环问题,可以先染色缩点重建图,然后就是如何来处理这个路径可以相交这个问题,这里可以用bfs求出任意两点之间是否可达,如果可达,就连边,然后就是HK算法求最大匹配了,最小路径覆盖 = 顶点数 - 最大匹配. #include <iostream> #include <cstdio> #inc…
题目链接:http://poj.org/problem?id=2594 Treasure Exploration Time Limit: 6000MS   Memory Limit: 65536K Total Submissions:10480   Accepted: 4250 Description Have you ever read any book about treasure exploration? Have you ever see any film about treasure…
题目链接:http://poj.org/problem?id=2594 思路:本来求最小路径覆盖是不能相交的,那么对于那些本来就可达的点怎么处理,我们可以求一次传递闭包,相当于是加边,这样我们就可以来求最小路径覆盖了.最小路径覆盖=顶点数-最大匹配.http://www.cnblogs.com/ka200812/archive/2011/07/31/2122641.html http://paste.ubuntu.com/5943395/…
POJ 1422 Air Raid 题目链接 题意:给定一个有向图,在这个图上的某些点上放伞兵,能够使伞兵能够走到图上全部的点.且每一个点仅仅被一个伞兵走一次.问至少放多少伞兵 思路:二分图的最小路径覆盖,每一个点拆成两个点,然后依据有向边连边,然后答案为n - 最大匹配数 代码: #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespa…
链接: http://poj.org/problem?id=3020 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/M Antenna Placement Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5500   Accepted: 2750 Description The Global Aerial Research Centr…
原题传送:http://poj.org/problem?id=3020 Antenna Placement Time Limit: 1000MS Memory Limit: 65536K Description The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking…