摘要: 二分图匹配。如果i行j列是1,则i向j连边。如果这个二分图能够完全匹配了,则有解,反之无解。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 7 #define N 222 8 #define M 55555 9 10 using namespace std;11 12 int head[N],next[M],to[M];13 int cnt,n,l 阅读全文
posted @ 2013-03-13 00:17 proverbs 阅读(942) 评论(0) 推荐(0) 编辑
摘要: 这题zxr神犇当场ak了。。无限仰慕,用的是zxr神犇的方法,没有Riatre的~不加通道前时一棵树,然后根据这个再树上贪心就好了,反正我是没想到。。。View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <algorithm> 6 7 #define N 111111 8 #define M 555555 9 10 using namespace std;11 12 int n, 阅读全文
posted @ 2013-03-13 00:10 proverbs 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 这个题真是不爽,人家set又短又快,我这个又长又慢,差十几毫秒tle。。。我是一个splay维护相邻的最差小值,一个是维护全局最小差值(在插入的时候用前驱和后继更新)View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <algorithm> 5 #include <cstdlib> 6 #include <cmath> 7 8 #define N 2222222 9 #define INF 1LL<&l 阅读全文
posted @ 2013-03-13 00:05 proverbs 阅读(839) 评论(0) 推荐(0) 编辑
摘要: 理清思路,在草稿纸上写清楚需要哪些数据结构,分别维护什么,这样以后再写,思路还是很清晰的。就是好久不写数据结构,略微忘记了。。。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 7 #define N 1111111 8 #define INF 1LL<<60 9 #define MOD 999997 10 11 using namesp 阅读全文
posted @ 2013-03-13 00:01 proverbs 阅读(1155) 评论(0) 推荐(1) 编辑