最大流
文章平均质量分 78
byijie
这个作者很懒,什么都没留下…
展开
-
POJ 3436 拆点建图,第二道最大流
由于容量限制在点上,不是在边上,所以把一个点拆成两个点,一个是“入口”一个是“出口”,之间用点的容量建一条边...(这让我想到了关于空间维度的问题...= =||) 总结一下初级图论知识: 单源最短路 bell-fordman(用队列优化一下就是spfa,shortest path faster algorithm) 是可以用来找环的,一般是找负环,修改一下能找正环,时间分析:没加优化O(VE原创 2013-01-20 15:23:04 · 1217 阅读 · 0 评论 -
codeforces 277E 最小费用最大流
用邻接矩阵和邻接表两种方式各写了一遍...= =||| 矩阵代码:(953ms) #include #include #include #include #include using namespace std; #define Inf 0x7fffffff #define DInf 1e9 #define eps 1e-9 #define maxn 1005 int Cap[maxn][ma原创 2013-03-02 22:07:09 · 811 阅读 · 0 评论 -
hdu4307 Matrix 最小割
...其实SAP也可以写的很短!!,不考虑bfs优化的话20行代码... #include #include #include #include #include #include #include using namespace std; const int inf=0x3fffffff; const int maxn=1005; struct edge { int to,ec,ne原创 2013-07-03 22:57:47 · 873 阅读 · 0 评论 -
hdu4309 Seikimatsu Occult Tonneru
wa了一上午,午睡的时候突然想到数组大小,改大一倍竟然就过了,看来以后在内存允许的情况下,开数组还是别卡数据范围比较好。。。 #include #include #include #include #include #include #include using namespace std; const int maxn=222; const int maxe=3333; const int i原创 2013-07-04 14:01:33 · 926 阅读 · 0 评论 -
hdu4322 Candy 费用流
//#include #include #include #include #include #include #include using namespace std; const int inf=0x3fffffff; const int maxn=105; struct edge { int to,c,d,next; }ee[maxn*maxn]; int e[maxn],ecnt;原创 2013-08-05 12:11:48 · 947 阅读 · 0 评论 -
最大流模板
自己写的模板,稍微挫了点儿但是容易理解... 用pku 1459 测试的模板,如发现错误请留言指出 由于着急做题,只看了3种算法,Ford-Fulkerson,Edmonds-Karp(VE^2),Shortest Augment Path(SAP) (V^2 E),实现了后两种,什么dinic,预留推进之类的考完试再补吧,到时顺便复习一下。 看了别人博客,发现常用的算法分为增广路算法和预留推原创 2012-12-31 17:58:27 · 746 阅读 · 0 评论 -
hdu4744 Starloop System
建模方法大概就是像网上其他人说的那样。。。可以看oyk的博客http://www.cnblogs.com/oyking/archive/2013/09/15/3323483.html 下面讨论一下为什么这样建模是对的: 一个点u属于k个简单环的话,那么在每个环里都有两条边连u,所以u共有2k条边。 考虑一个环中u的两条无向边,可以转换成两条有向边,一个进入u,一个从u出去。 那么对于一个原创 2013-09-16 20:55:28 · 1200 阅读 · 0 评论