2012年8月13日

网络流SAP--模板

摘要: 1 #include<stdio.h> 2 #include<iostream> 3 #include<algorithm> 4 using namespace std; 5 typedef struct {int v,next,val;} edge; 6 const int MAXN=20010; 7 const int MAXM=500010; 8 edge e[MAXM]; 9 int p[MAXN],eid; 10 inline void init(){memset(p,-1,sizeof(p));eid=0;} 11 //有向 12 inline 阅读全文

posted @ 2012-08-13 21:38 acoderworld 阅读(286) 评论(0) 推荐(0)

网络流Dinic模板

摘要: 1 #define INF 2000000000 2 #define typec int//type of cost 3 const int pN=600000,eN=3000000; 4 struct Edge{ 5 int u,v,next; 6 typec w; 7 }; 8 Edge edge[eN]; 9 int en,head[pN],cur[pN],ps[pN],dep[pN];10 void insert(int u,int v,typec w){11 edge[en].u=u;12 edge[en].v=v;13 edge[en].w... 阅读全文

posted @ 2012-08-13 20:57 acoderworld 阅读(73) 评论(0) 推荐(0)

【转】最小树形图 模版--朱刘算法

摘要: 1 #define INF 0x7fffffff 2 #define MAXN 1005 3 typedef __int64 type; 4 struct node 5 { 6 int u, v; 7 type w; 8 }edge[MAXN * MAXN]; 9 int pre[MAXN],id[MAXN],vis[MAXN],n,m,pos;10 type in[MAXN];11 type Directed_MST(int root, int V, int E)12 {13 int i;14 type ret = 0;15 while(true)1... 阅读全文

posted @ 2012-08-13 11:42 acoderworld 阅读(67) 评论(0) 推荐(0)

导航