随笔分类 -  图--网络流

摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=677题意转化:将点0与所有的有间谍的点相连,则题意变为求点0到点n的最小割,直接套最大流EK算法~下面代码顶点是从1~n+1代码入下: #include "stdio.h"#include ... 阅读全文
posted @ 2014-05-23 20:30 ruo_yu 阅读(135) 评论(0) 推荐(0)
摘要:问题 D: 探 寻 宝 藏时间限制:1 Sec内存限制:128 MB题目描述传说HMH大沙漠中有一个M*N迷宫,里面藏有许多宝物。某天,Dr.Kong找到了迷宫的地图,他发现迷宫内处处有宝物,最珍贵的宝物就藏在右下角,迷宫的进出口在左上角。当然,迷宫中的通路不是平坦的,到处都是陷阱。Dr.Kong决... 阅读全文
posted @ 2014-05-19 18:01 ruo_yu 阅读(187) 评论(0) 推荐(0)
摘要:#include "stdio.h" //poj 2195 最小费用最大流#include "string.h"#include "queue"#include "math.h"using namespace std;#define N 210#define INF 0x3fffffffstru... 阅读全文
posted @ 2013-12-08 12:33 ruo_yu 阅读(158) 评论(0) 推荐(0)
摘要:/*思路:start=0为起点,1~F中每个点为每份food的编号,F+1~F+n中为每头牛的编号,另外F+n+1~F+n+n中也为每头牛的编号,F+n+n+1~F+n+n+D中每个点为每份drink的编号,F+n+n+D+1为终点; 从start到每份food连边,权值为1,; ... 阅读全文
posted @ 2013-12-08 10:59 ruo_yu 阅读(507) 评论(0) 推荐(0)
摘要:#include "stdio.h" // 最小费用最大流 poj 2516#include "string.h"#include "queue"using namespace std;#define N 115#define INF 1000000000struct node { int u,v... 阅读全文
posted @ 2013-12-07 13:13 ruo_yu 阅读(326) 评论(0) 推荐(0)
摘要:#include "stdio.h" //poj 1149 最大流#include "string.h"#include "queue"using namespace std;#define N 2250#define INF 0x3fffffffstruct node{ int u,v,w; ... 阅读全文
posted @ 2013-12-04 20:40 ruo_yu 阅读(154) 评论(0) 推荐(0)
摘要:#include "stdio.h" //poj 1459 最大流#include "string.h"#include "queue"using namespace std;#define N 205#define INF 0x3fffffffint n;bool mark;int map[N][... 阅读全文
posted @ 2013-12-04 19:25 ruo_yu 阅读(185) 评论(0) 推荐(0)
摘要:#include "stdio.h" //额,按最小费用最大流的模板来的!poj 3422#include "string.h"#include "queue"using namespace std;#define N 5005#define INF 0x3fffffffstruct node{ ... 阅读全文
posted @ 2013-12-03 19:34 ruo_yu 阅读(192) 评论(0) 推荐(0)
摘要:#include "stdio.h" //hdu 2686 最小费用最大流#include "string.h"#include "queue"using namespace std;#define N 2005#define INF 0x3fffffffstruct node { int u,v,... 阅读全文
posted @ 2013-11-29 19:18 ruo_yu 阅读(147) 评论(0) 推荐(0)
摘要:#include "stdio.h" //poj 2135 最小费用最大流模板#include "string.h"#include using namespace std;#define N 1005#define INF 0x3fffffffstruct node { int u,v; int ... 阅读全文
posted @ 2013-11-28 14:13 ruo_yu 阅读(228) 评论(0) 推荐(0)
摘要:#include "stdio.h" //最大流模板 poj 1273#include "queue"using namespace std;int n,m;#define N 205#define INF 0x3fffffffint map[N][N];int maxf[N];int route... 阅读全文
posted @ 2013-11-27 15:58 ruo_yu 阅读(179) 评论(0) 推荐(0)