随笔分类 - 图论——最大流最小割
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4280#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#includeusing namespace std;const int maxn = 100005;const int maxe = 500000;const int INF = 0x3f3f3f;struct Edge{ int v,flow,cap; int next; Edge(int v=0
阅读全文
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1760#include #include #include #include #include #include #include #define maxn 105#define maxe 100000using namespace std;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap; int next; Edge(int u=0,int v=0,int flow=0,int cap...
阅读全文
摘要:题目链接:http://poj.org/problem?id=1149#include #include #include #include #include #include #include #define maxn 1050#define maxe 200000using namespace std;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap; int next; Edge(int u=0,int v=0,int flow=0,int cap=0,int next=0): u(u),v(v...
阅读全文
摘要:题目链接:http://poj.org/problem?id=3281#include #include #include #include #include #include #include #define maxn 105#define maxe 20000using namespace std;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap; int next; Edge(int u=0,int v=0,int flow=0,int cap=0,int next=0): u(u),v(v),...
阅读全文
摘要:题目链接:http://poj.org/problem?id=3469#include #include #include #include #include #include #include #define maxn 23000#define maxe 242000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t; int head[maxn]; int cur[maxn]; E...
阅读全文
摘要:题目链接:http://poj.org/problem?id=3084本题主要在构图上,我采用的是把要保护的房间与源点相连,有intruder的与汇点相连,相对麻烦。#include #include #include #include #include #include #include #define maxn 30#define maxe 5000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t...
阅读全文
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2609#include #include #include #include #include #include #include #define maxn 450#define maxe 100000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t; int h...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int maxn = 100; 9 const int INF = 0x3f3f3f3f;10 int cap[maxn][maxn];11 int flow[maxn][maxn];12 int s,t;13 int n,m;14 int num[30];15 int ansf;16 17 void EK(){18 ansf = 0;19 memset(flow,0,sizeof(flow));2...
阅读全文