
NetWork Flow
文章平均质量分 75
unixcsir
Coding Every Day~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj_1698
/ * * Maximum flow, each week, each day is split into a point src origin to the point of flow 1 * Corresponding to each of the movie a certain days of the week, and these days is connected to the原创 2012-09-26 18:57:04 · 259 阅读 · 0 评论 -
hdu_4289
跟3491基本上一样,最小割,不同的是该题,原点和会点都可以设置边#include #include #include #include #define MAXV 402#define MAXE 80001#define INF 0x7fffffffusing namespace std;struct Edge{ int v, val, next原创 2012-09-20 19:57:25 · 331 阅读 · 0 评论 -
hdu_4280
2012 icpc 长春赛区的最大流模板题, 模板的高效性很重要#include #include #include #include #define MAXVERTEX 100001#define MAXARC 400010#define INF 0x7fffffff#pragma comment(linker, "/STACK:1024000000,1024000000"原创 2012-09-20 19:42:58 · 352 阅读 · 0 评论 -
hdu_4292
2012 icpc 成都赛区的一题, 被坑了..唉往事不堪重提#include #include #include #define MAXVERTEX 803#define MAXARC 170000#define INF 0x7fffffffusing namespace std;struct Edge{ int v, val, next;}edge[MAXARC];原创 2012-09-20 19:41:22 · 391 阅读 · 0 评论 -
hdu_3572
没有什么好说的#include #include #include #include #define MAXN 1005#define MAXM 100500#define INF 0x7fffffffusing namespace std;struct Edge { int v, val, next;}edge[MAXM];struct Point { int ac原创 2012-09-20 19:39:53 · 292 阅读 · 0 评论 -
hdu_1281
ek超时,简单的dinic或者isap的应用#include #include #include #include #define MAXROW 109#define MAXCOL 109#define INF 0x7fffffffusing namespace std;typedef struct p{ int x; int y;}Point;int row;in原创 2012-09-20 19:38:21 · 256 阅读 · 0 评论 -
hdu_3046
这题可以说是最小割模型最容易的一道题目了。根据割的定义我们知道,割其实就是将原图的点集分成两个部分(s',t')。两个部分分别包含源点S,汇点T。那这道题目里,就是要把点集分成羊一个集合(sheep),狼一个集合(wolf)。S->sheepwolf->T因为在矩阵中,可以随便走。所以矩阵中相邻的两点建立双向边,容量为1。求最小割,就是答案#include #in原创 2012-09-20 19:36:26 · 357 阅读 · 0 评论 -
hdu_3549
最大流#include #include #include #define MAXVERTEX 20#define MAXARC 2001#define INF 0x7fffffffusing namespace std;struct Edge { int v, w, next;}edge[MAXARC];int vertex, arc, cnt_edge, he原创 2012-09-20 19:32:54 · 262 阅读 · 0 评论 -
hdu_1565&1569
1565和1569除了数据范围和输入不一样之外其余的都一样这题是最典型的最大点权独立集。实际上,我们要先算最小点权覆盖集,然后用总的点权和-最小点权覆盖集,得出答案。 我们要把原图改成二分图。进行黑白染色,比如一个3*3的矩阵1 2 34 5 67 8 9那么点1,3,5,7,9为一个集合(n)点2,4,6,8为一个集合(m)源点连向n集合,m集合连向汇点,原创 2012-09-20 19:28:50 · 330 阅读 · 0 评论 -
hdu_1532
网络流裸题, ek#include #include #include #define MAXSIZE 201#define INF 0x7fffffffusing namespace std;int edge;int vertex;int level[MAXSIZE];int r[MAXSIZE][MAXSIZE];bool bfs(void){ int cur;原创 2012-09-20 19:25:49 · 261 阅读 · 0 评论 -
hdu_3081
二分+最大流,处理关系的时候使用并查集会比较好,建图简单,忽略#include #include #include #define MAXVERTEX 512#define INF 0x7fffffffusing namespace std;typedef struct $edge { int x, y;}Edge;Edge edge_arr[MAXVERTEX*MAX原创 2012-09-20 19:23:39 · 451 阅读 · 0 评论 -
hdu_3277
最大流+二分,建图跟3081差不多,这里就省略, code 如下。#include #include #include #include #define MAXVERTEX 800#define INF 0x7fffffff#define MAXARC MAXVERTEX*MAXVERTEXusing namespace std;struct Edge { int v原创 2012-09-20 19:21:08 · 477 阅读 · 0 评论 -
2135_poj
/* * 設從1到n的一條路徑為way1,從n到1的一條路徑為way2 * way1,way2中定點可相交,但是邊不可以,題意為min(way1+way2) * 這可以想成是最小費用最大流的問題,因為兩條路徑沒有邊的交集 * 可以設置原點到1的flow為2,n到匯點的flow也為2,因為每段路徑的邊 * 只能走一次,所以每個可以連接的點之間連接flow為1 * 費用則為題目給出的兩點之原创 2012-09-25 10:41:12 · 246 阅读 · 0 评论 -
poj_1274
/ * * Maximum flow model * Built diagram, src-> cow-> stall-> des, all edges of the flow 1 ans = maximum flow* /#include #include #include #include using namespace std;#define MAXN 2000#原创 2012-09-25 20:09:01 · 238 阅读 · 0 评论 -
hdu_3491
Relatively easy to see it is a minimal cut.I use minimum cut + demolition point.Title means: a gang of thieves think T city stealing, they are currently in the S city.Now the police want this ga原创 2012-09-20 19:35:00 · 525 阅读 · 0 评论 -
hdu_2732
First bs output under this title, and then built the diagram is very simple, it needs an overhaul#include #include #include #include #define DIR 4#define MAXS 22#define MAXN 805#define MAXM 75原创 2012-09-20 19:31:37 · 601 阅读 · 0 评论 -
hdu_2544
/* * 典型最短路问题,邻接矩阵+spfa * 注意重边的情况*/#include #include #include #include #define MAXN 101#define MAXM 10001#define INF 0x7fffffffusing namespace std;int dis[MAXN], used[MAXN], val[MAXN][MAX原创 2012-09-24 11:18:23 · 259 阅读 · 0 评论