上一页 1 2 3 4 5 6 7 8 9 10 ··· 18 下一页
View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<queue>using namespace std;#define maxn 5010#define maxm 10030#define inf 1000000000int min(int a, int b){ return a < b ? a : b;}struct E{ int u, v, c, w, next;}edge[maxm<<3];int head[maxn], tot; Read More
posted @ 2012-10-22 18:25 To be an ACMan Views(132) Comments(0) Diggs(0)
View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<queue>using namespace std;#define maxn 1010#define maxm 10003#define inf 1000000000int min(int a, int b){ return a < b ? a : b;}struct E{ int u, v, c, w, next;}edge[maxm<<3];int head[maxn], tot; Read More
posted @ 2012-10-21 00:57 To be an ACMan Views(202) Comments(0) Diggs(0)
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(175) 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(255) 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)
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;void add(int s, int t, int c Read More
posted @ 2012-10-19 22:34 To be an ACMan Views(226) Comments(0) Diggs(0)
View Code #include<stdio.h> #include<string.h> const int maxn = 20100; const int maxm = 200200; const int inf = 1<<29; struct node { int v, c, next; }edge[maxm*6]; int head[maxn], tot; int n, m; void init() { int i; for(i = 0; i <= n+2; i++) head[i] = -1; tot = 0; } voi... Read More
posted @ 2012-10-18 19:44 To be an ACMan Views(143) Comments(0) Diggs(0)
1062* 昂贵的聘礼 枚举等级限制+dijkstra1087* A Plug for UNIX 2分匹配1094 Sorting It All Out floyd 或 拓扑1112* Team Them Up! 2分图染色+DP1122 FDNY to the Rescue! 最短路1125 Stockbroker Grapevine FLOYD1128 Frame Stacking 拓扑排序1135 Domino Effect 最短路 1149* PIGS 网络流1161* Walls Floyd1192 最优连通子集1201 Intervals 差分约束1236* Network of Read More
posted @ 2012-10-18 15:53 To be an ACMan Views(340) Comments(0) Diggs(0)
为什么要拆点:2 410 0 0 0 110 0 0 0 010 0 1 1 110 0 1 1 1拆点10, 不拆点20做最大流的题目无非是这两步。1.建图2.套sap+gap优化的模板View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxn 106#define inf 1000000000int min(int a, int b){ return a < b ? a : b;}struct E{ int v, n Read More
posted @ 2012-10-18 15:31 To be an ACMan Views(190) Comments(0) Diggs(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 18 下一页