POJ2175 Evacuation Plan 最小费用流 负权消去
The City has a number of municipal buildings and a number of fallout shelters that were build specially to hide municipal workers in case of a nuclear war. Each fallout shelter has a limited capacity in terms of a numbe...
分类:
其他好文 时间:
2015-05-02 09:54:06
阅读次数:
200
最大流 最小费用流 POJ3686 The Windy's
The Windy's is a world famous toy factory that owns M top-class workshop to make toys. This year the manager receives N orders for toys. The manager knows that every order will take different amount of hours in different work...
TransportationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2301Accepted Submission(s): 966Probl...
分类:
其他好文 时间:
2015-04-29 21:28:49
阅读次数:
129
POJ2135 Farm Tour 最大流 最小费用流
When FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields numbered 1..N, the first of which contains his house and the Nth of which contains the big barn. A total M (1 <...
分类:
其他好文 时间:
2015-04-29 11:54:17
阅读次数:
151
1 bool spfa(int s, int t) { 2 queue Q; 3 Q.push(s); 4 rst(d, inf); 5 rst(p, -1); 6 rst(pp, -1); 7 d[s] = 0; 8 vis[s] = tr...
分类:
其他好文 时间:
2015-04-25 18:17:05
阅读次数:
143
题意:
给n给开区间(ai,bi)及相应权值wi,现在要选一些区间,要求任一点不能被超过k个区间覆盖,目标是最大化总的权重。
分析:
转化为求最大费用流,改改最小费用流的模板就好。
代码:
//poj 3680
//sep9
#include
#include
#include
#include
using namespace std;
const int maxN=2048;...
分类:
其他好文 时间:
2015-04-01 22:00:10
阅读次数:
158
题目大意是说有一个B矩阵,现在A是一个空矩阵(每个元素都为0),每次操作可以将A矩阵相邻的两个元素同时+1,但是有个要求就是A矩阵的每个元素都不可以超过K,求这个的最小值解题思路是这样的,新建起点与奇点(i != j)连K条边,第i条边的权值为(i - B)^2 - (i - 1 - B)^2 = ...
分类:
其他好文 时间:
2015-03-28 23:02:52
阅读次数:
202
练习题目:点击打开链接 网络流建模:点击打开链接
之前写过 关于网络流的算法入门,其实那么多会一个就OK.首选Dinic,递归很好写25行.
邻接表时候若是无向图则是四条边
解决和值问题,都并入汇点
找多条不同的路径,最小费用流问题.
J 模板题
测试Dinic模板
K 电脑公司,
这个其实也可以不用拆点,不过拆点更容易想,这个是第一个需要构图的题目,完全不会.其实就是不同类型机...
分类:
其他好文 时间:
2015-02-27 11:57:33
阅读次数:
224
题意:给出一个有向带权图,求从起点到终点的两条不相交路径使得权值和最小。分析:第一次听到“拆点法”这个名词。把除起点和终点以外的点拆成两个点i和i',然后在这两点之间连一条容量为1,费用为0的边。这样就保证了每个点最多经过一次。其他有向边的容量也是1然后求从起点到终点的流量为2(这样就保证了是两条路...
分类:
其他好文 时间:
2015-02-10 00:25:28
阅读次数:
279