2012年3月8日

网络流算法之一

摘要: 1. Edmonds-karp 算法用广度优先搜索来实现对增广路径p的计算,即如果增广入径是残留网络中从(s到t的最短路径,就能改进FORD-FULKERSON的界,称Ford-Fulkerson方法的这种实现为Edmonds-karp算法,时间复杂度为O(VE^2);HDU 3549View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <deque>using namespace std;int cap[100][100];int a[100];in 阅读全文

posted @ 2012-03-08 23:24 more think, more gains 阅读(558) 评论(0) 推荐(0) 编辑

二分图KM算法 HDU 2255

摘要: 在百度百科学了KM算法。。km算法是求完备匹配下的最大权KM算法流程:1.对二分图的两部分顶点初始化2.KM算法用匈牙利算法寻找完备匹配3.如果未找到就修改相应顶点值4重复(2)(3)直到找到相等子图的完备匹配为止;HDU 2255是裸题。。未优化版:View Code #include<stdio.h>#include<string.h>#include<stdlib.h>int match[1000];int mp[400][400];bool visitx[400], visity[400];int xx[400], yy[400];const int 阅读全文

posted @ 2012-03-08 14:11 more think, more gains 阅读(285) 评论(0) 推荐(0) 编辑

导航