随笔分类 -  最小费用最大流

Drainage Ditches(Dinic最大流)
摘要:http://poj.org/problem?id=1273用Dinic求最大流的模板题,注意会有重边。邻接矩阵建图 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn = 510; 7 const int INF = 0x3f3f3f3f; 8 int flow[maxn][maxn];//残量 9 int m,n;10 int dis[maxn];11 int bfs()//按层数“建”图,就是对每层的点用dis标记它到源点的层数12 {13 queueque;14 ... 阅读全文
posted @ 2013-12-07 14:52 straw_berry 阅读(214) 评论(0) 推荐(0)
Minimum Cost(最小费用最大流)
摘要:DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (marked from 1 to M), each provides K different kinds of goods (marked from 1 to K). Once s 阅读全文
posted @ 2013-11-30 22:00 straw_berry 阅读(882) 评论(0) 推荐(0)
Going Home(最小费用最大流)
摘要:Time Limit:1000MSMemory Limit:65536KTotal Submissions:16200Accepted:8283DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a $1 travel 阅读全文
posted @ 2013-11-08 11:24 straw_berry 阅读(222) 评论(0) 推荐(0)
Power Network (最大流增广路算法模板题)
摘要:Time Limit:2000MSMemory Limit:32768KTotal Submissions:20754Accepted:10872DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amount 0 2 #include 3 #i 阅读全文
posted @ 2013-08-12 16:55 straw_berry 阅读(243) 评论(0) 推荐(0)