题意: 有一个城镇,它的所有街道都是单行(即有向)的,并且每条街道都是和两个路口相连.同时已知街道不会形成回路. 可以在任意一个路口放置一个伞兵,这个伞兵会顺着街道走,依次经过若干个路口. 问最少需要投放几个伞兵,使得每个路口都被伞兵拜访过.并且要满足每个路口只能被一个伞兵拜访过. 思路: 裸DAG图的最小路径覆盖. DAG图的最小路径覆盖数 = 节点数 - 二分图最大匹配 代码: vector<int> graph[125]; int cx[125],cy[125]; bool bmask[…
UVA 1201 - Taxi Cab Scheme 题目链接 题意:给定一些乘客.每一个乘客须要一个出租车,有一个起始时刻,起点,终点,行走路程为曼哈顿距离,每辆出租车必须在乘客一分钟之前到达.问最少须要几辆出租车 思路:假设一辆车载完一个乘客a,能去载乘客b,就连一条有向边,这样做完整个图形成一个DAG,然后要求的最少数量就是最小路径覆盖.利用二分图最大匹配去做,把每一个点拆成两点.假设有边就连边,做一次最大匹配.n - 最大匹配数就是答案 代码: #include <cstdio> #i…
题意: 出租车公司有M个订单. 订单格式:     hh:mm  a  b  c  d 含义:在hh:mm这个时刻客人将从(a,b)这个位置出发,他(她)要去(c,d)这个位置. 规定1:从(a,b)到(c,d)所花的时间为:abs(a-c)+abs(b-d). 规定2:一辆出租车如果要接单,必须在客人出发前1分钟(包括)以前接单. 问,最少派出多少辆出租车,可以完成所有任务. 思路: 把每一笔单看成一个点,如果完成第i个单后可以接到第j个单,则 i->j连上线. 则题为:求这个DAG图的最小路…
http://poj.org/problem?id=2060 Taxi Cab Scheme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5459   Accepted: 2286 Description Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination…
点击打开链接 有向无环图的最小路径覆盖 = 顶点数- 最大匹配 #include <queue> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int maxn = 150; int g[maxn][maxn]; int n, m; int link[maxn]; bool used[…
Taxi Cab Scheme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5710   Accepted: 2393 Description Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up…
题目链接: http://acm.hust.edu.cn/vjudge/problem/356788 Airports Time Limit: 3000MS 问题描述 An airline company offers flights out of n airports, conveniently labeled from 1 to n. The flight time tij from airport i to airport j is known for every i and j. It…
对于什么是DAG最小路径覆盖以及解题方法在我的另外的博客已经有了.http://www.cnblogs.com/Potato-lover/p/3980470.html 此题的题意: 公交车(出租车)车站有一个固定的发车时间,有二维起点和终点,花费的时间是两点的曼哈顿距离,即|x1-x2| + |y1-y2| .问最少需要多少辆车才能跑完所有路线. 思路: A站点发车时间如果大于车到达B站点的时间与车从B站点到达A站点的时间,就可以连边.然后求最大匹配.最小路径覆盖 = 顶点数 -  最大匹配 有…
Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's streets you can never reach the same intersection i.e. the town's…
DAG的最小路径覆盖 定义:在一个有向图中,找出最少的路径,使得这些路径经过了所有的点. 最小路径覆盖分为最小不相交路径覆盖和最小可相交路径覆盖. 最小不相交路径覆盖:每一条路径经过的顶点各不相同.如图,其最小路径覆盖数为3.即1->3>4,2,5. 最小可相交路径覆盖:每一条路径经过的顶点可以相同.如果其最小路径覆盖数为2.即1->3->4,2->3>5. 特别的,每个点自己也可以称为是路径覆盖,只不过路径的长度是0. DAG的最小不相交路径覆盖 算法:把原图的每个点…