摘要: 跟上一题差不多,就是输入的处理比较麻烦。View Code #include <stdio.h>#include <string.h>#include <queue>using namespace std;#define MIN(a,b) ((a)<(b)?(a):(b))#define N 105int n,ns,nt,m;int g[N][N];int pre[N];void EK(int s,int t){ int u,v,maxflow=0; while(1) { queue<int>q; memset(pre,-1,sizeof( 阅读全文
posted @ 2012-07-27 17:35 BeatLJ 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 比较简单的网络流。需要注意的地方:1、数据中有重边;2、输入均为单向边。View Code #include <stdio.h>#include <string.h>#include <queue>using namespace std;#define MIN(a,b) ((a)<(b)?(a):(b))#define N 201#define INF 0x3ffffffint n,m;int g[N][N];int pre[N];void EK(int s,int t){ int maxflow=0; int u,v; while(true) { q 阅读全文
posted @ 2012-07-27 17:34 BeatLJ 阅读(222) 评论(0) 推荐(0) 编辑
摘要: Description现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的,而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形: 左上角点为(1,1),右下角点为(N,M)(上图中N=4,M=5).有以下三种类型的道路 1:(x,y)<==>(x+1,y) 2:(x,y)<==>(x,y+1) 3:(x,y)<==>(x+1,y+1) 道路上的权值表示这条路上最多能够通过的兔子数,道路是无向的. 左上角和右下角为兔子的两个窝,开始时所有的兔子都聚集在左上角(1,1)的窝里,现在 阅读全文
posted @ 2012-07-27 17:32 BeatLJ 阅读(251) 评论(0) 推荐(0) 编辑