View Code #include<stdio.h>#include<string.h>#define maxn 504#define maxm 100003#define inf 1000000000int min(int a, int b){ return a < b ? a : b;}int max(int a, int b){ return a > b ? a : b;}struct E{ int v, next, c;}edge[maxm];int head[maxn], tot;int n, m;int S, T;int s, t;void i Read More
posted @ 2012-10-20 23:17
To be an ACMan
Views(344)
Comments(0)
Diggs(0)
View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxn 410#define maxm 40003#define inf 1000000000int min(int a, int b){ return a < b ? a : b;}struct E{ int v, next, c;}edge[maxm];int head[maxn], tot;int n, m;int S, T;void add(int s, int Read More
posted @ 2012-10-20 15:37
To be an ACMan
Views(176)
Comments(0)
Diggs(0)
每条边的容量满足一定的限制,即有一个上限值,也有一个下限值上界用ci表示,下界用bi表示。下界是必须流满的,那么对于每一条边,去掉下界后,其自由流为ci– bi。主要思想:每一个点流进来的流=流出去的流对于每一个点i,令Mi= sum(i点所有流进来的下界流)– sum(i点所有流出去的下界流)如果Mi大于0,代表此点必须还要流出去Mi的自由流,那么我们从源点连一条Mi的边到该点。如果Mi小于0,代表此点必须还要流进来Mi的自由流,那么我们从该点连一条Mi的边到汇点。如果求S->T的最大流,看是否满流(S的相邻边都流满)。满流则有解,否则无解。View Code #include< Read More
posted @ 2012-10-20 15:29
To be an ACMan
Views(256)
Comments(0)
Diggs(0)
View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxn 803#define maxm 10003#define inf 1000000000int min(int a, int b){ return a < b ? a : b;}struct E{ int v, next, c;}edge[maxm<<2];int head[maxn], tot;int n, m, s, t;void add(int Read More
posted @ 2012-10-20 10:50
To be an ACMan
Views(160)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号