Description Gabiluso is one of the greatest spies in his country. Now he’s trying to complete an “impossible” mission ----- to make it slow for the army of City Colugu to reach the airport. City Colugu has n bus stations and m roads. Each road connec…
Problem Description Gabiluso is one of the greatest spies in his country. Now he's trying to complete an "impossible" mission ----- to make it slow for the army of City Colugu to reach the airport. City Colugu has n bus stations and m roads. Eac…
http://acm.hdu.edu.cn/showproblem.php?pid=2485 题意: 现在要从起点1到终点n,途中有多个车站,每经过一个车站为1时间,现在要在k时间内到达终点,问至少要破坏多少个车站. 思路: 把每个点拆分为两个点,容量为1,费用为0.之后相邻的车站连边,容量为INF,费用为1,表示经过一个车站需要1时间. 这样一来,跑一遍费用流计算出在费用不大于k的情况下的最大流,也就是最小割,即至少要破坏的车站数. 在网络中寻求关于f的最小费用增广路,就等价于在伴随网络中寻求…
题意: 最少需要几个点才能使得有向图中1->n的距离大于k. 分析: 删除某一点的以后,与它相连的所有边都不存在了,相当于点的容量为1.但是在网络流中我们只能直接限制边的容量.所以需要拆点来完成对的点容量的限制.对于边i -> j,先建边i ->i',再建i'->j.i ->i'只能建一次,容量为1,费用为0.i'->j的容量是INF.此题中因为已经有源点,所以源点(1)不能限制容量. #include<iostream> #include<cstdi…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2485 题意:给你n个点,m条相连的边,问你最少去掉几个点使从1到n最小路径>=k,其中不能去掉1,n两个点. 题解:这个题目可以用最小流解决,也可以用IDA*  +  BFS解决. AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <string> #include…
2015 ACM / ICPC 北京站 热身赛 C题 #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<vector> #include<algorithm> using namespace std; const int INF=0x7FFFFFFF; +;//点的数量 int n,m,k; +],v[+]; int dis1[max…
Destroying the bus stations                                                                                     Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)                                                       …
Destroying the bus stations Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1832   Accepted: 595 Description Gabiluso is one of the greatest spies in his country. Now he's trying to complete an “impossible” mission - to make it slow for…
http://acm.split.hdu.edu.cn/showproblem.php?pid=5988 题意:在acm比赛的时候有多个桌子,桌子与桌子之间都有线路相连,每个桌子上会有一些人和一些食物,现在要吃午饭了,有些人就可能需要到别的桌子去拿食物,但是必须沿着线路走,每根线路第一个人走时没事,接下来的人走时会有一定概率使网络瘫痪,并且每根线路最多可以走c人.现在问使网络瘫痪的最低概率是多少? 思路:建立费用流,由于概率是要相乘,这里可以转换成log后进行计算,最后再转换回来即可. 由于这题…
Problem Description   A new candy factory opens in pku-town. The factory import M machines to produce high quality candies. These machines are numbered from 1 to M.  There are N candies need to be produced. These candies are also numbered from 1 to N…