摘要: 1、凸包 1 inline bool cmp(const POINT &a, const POINT &b) { 2 if(a.y == b.y) return a.x = 0; 8 } 9 10 inline double dist(POINT &a, POINT &b) {11 return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));12 }13 14 void Graham_scan() {15 std::sort(p, p + n, cmp);16 top = 1;17... 阅读全文
posted @ 2013-08-19 23:32 Oyking 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 一、平衡树1、treap树 1 int key[MAXN], weight[MAXN], child[MAXN][2], size[MAXN]; 2 int stk[MAXN], top, poi_cnt;//not use point 3 4 inline int newNode(int k) ... 阅读全文
posted @ 2013-08-19 23:27 Oyking 阅读(474) 评论(0) 推荐(0) 编辑
摘要: 1、求逆元1 int inv(int a) {2 if(a == 1) return 1;3 return (MOD - MOD / a) * inv(MOD % a);4 }View Code 2、线性筛法 1 bool isPrime[MAXN]; 2 int label[MAX... 阅读全文
posted @ 2013-08-19 23:14 Oyking 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 一、二分图1、最大匹配数=最大流=最小割=最小点集覆盖=总点数-最大独立集2、KM算法(最佳完美匹配) 1 int mat[MAXN][MAXN], slack[MAXN], Lx[MAXN], Ly[MAXN], left[MAXN]; 2 bool S[MAXN], T[MAXN]; ... 阅读全文
posted @ 2013-08-19 23:11 Oyking 阅读(372) 评论(0) 推荐(0) 编辑
摘要: DescriptionFacer is addicted to a game called "Tidy is learning to swim". But he finds it too easy. So he develops a new game called "Facer is learning to swim" which is more difficult and more interesting.In the new game, a robot named "Facer" is swimming in a pool. Th 阅读全文
posted @ 2013-08-19 20:09 Oyking 阅读(522) 评论(0) 推荐(0) 编辑