摘要: 最小权匹配:#include <iostream>#include <cstdio>#include <cstring>usingnamespace std;constint N =210;constint M =30100;constint inf =0x1fffffff;int n, m, tot, lx[N], ly[N], match[N], h[N], v[M], w[M], nxt[M];bool visx[N], visy[N];int lack;void add(int a, int b, int c){ v[tot] = b; w[tot] 阅读全文
posted @ 2012-09-23 20:06 fCarver7 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 以前做过的题目,现在整理了一下,去掉了和具体题目相关的细节,并加上了一些注释,方便使用吧。#include <iostream>#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int N = 1010;int n; //原图中共有2*n个相对的节点。int ct, depth, top, index[N<<1], d[N<<1], low[N<<1], 阅读全文
posted @ 2012-09-23 19:59 fCarver7 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 喜欢dinic算法,清晰,简洁,高效,优雅。uva820.#include <iostream>#include <cstdio>#include <string>#include <vector>#include <cstring>#include <utility>#include <algorithm>using namespace std;const int Maxn = 105;const int Maxm = 30005;const int inf = 0x1fffffff;int n, m, s, 阅读全文
posted @ 2012-09-23 19:35 fCarver7 阅读(191) 评论(0) 推荐(0) 编辑