摘要: 题目链接最小费用最大流算法 就好像是EK的变形。bfs的时候类似spfa找最短路,更新cost。因为我是从 EK 的代码基础上改的,然后没发现if(u == end) break;和这个不一样。。。一直WA,注意数组开大一点。先搜到的不一定是最优结果啊!!!最小费用 最大流 邻接表模版。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <queue> 5 using namespace std; 6 #define INF 0x7fffffff 7 in 阅读全文
posted @ 2013-02-25 17:11 Naix_x 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 邻接矩阵转邻接表,费了些时间啊。突然发现dinic用的好像是迭代深搜的思想把。dinic写的有点问题,删了。EK邻接表版本 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <queue> 5 using namespace std; 6 #define INF 0x7fffffff 7 int low[201],path[201]; 8 struct node 9 {10 int u,v,w,next,re;11 }edge[201*201];12 in 阅读全文
posted @ 2013-02-25 10:08 Naix_x 阅读(322) 评论(0) 推荐(0) 编辑