摘要: 分享自http://blog.csdn.net/renfufei/article/details/9733367 阅读全文
posted @ 2015-10-05 15:36 不会起昵称 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 记忆化搜索, 枚举所有的切割方式dp[r1][c1][r2][c2]表示(r1, c1) (r2, c2)之间的蛋糕切割所需要的最小花费count_num用来计算(r1, c1) (r2, c2)之间有多少个草莓递推边界当count_num为1是返回0 init()为对草莓数的一个预处理,使得... 阅读全文
posted @ 2015-08-31 19:14 不会起昵称 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 这道题像了很长时间才想明白了思路,没有明显的边界状态,状态转移也不能仅仅依靠一个dp数组。 dp[i][j][k][l] 代表四堆糖果分别拿了ijkl个还能拿到的最多糖果对数(是还能拿到,不算已经拿到的),can数组存储题目输入给出的糖果,top数组表示四堆糖果都拿到了第几个(就是为了简化代码),... 阅读全文
posted @ 2015-08-31 10:13 不会起昵称 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 套的Dinic模板,权当测模板了~ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #define PB push_back ... 阅读全文
posted @ 2015-08-24 23:40 不会起昵称 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 部分重合,端点重合,点边重合都会返回true 3 */ 4 struct PT{ 5 double x,y;//点的坐标 6 PT(double x = 0, double y = 0) : x(x), y(y){} 7 //bool operator 8 }... 阅读全文
posted @ 2015-08-24 23:37 不会起昵称 阅读(206) 评论(0) 推荐(0) 编辑
摘要: /*转自kuangbin博客http://www.cnblogs.com/kuangbin/*/#include#include#includeusing namespace std;const int maxn=105;/*接口:init(n); graham(n)n 为点的个数stack[0] ... 阅读全文
posted @ 2015-08-24 23:36 不会起昵称 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 有一次打比赛见到的,求一段区间内所有值的异或,对整块区间进行赋值,当时比赛时没有将模板调出来,感觉状压线段树可以当模板整理下来,转载注明出处谢谢 1 /* 2 _sum是对区间所有元素做或云算的值 3 */ 4 int _sum, y11, y22, v; 5 struct IntervalTree... 阅读全文
posted @ 2015-08-24 23:34 不会起昵称 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 转自kuangbin博客 http://www.cnblogs.com/kuangbin/ 1 /* 2 初始化调用build(1,1,n); n为边长 3 Modify(int x,int y,int val); 将点x,y处的值修改为val; 4 queryMax(1, x1, x2, y1, ... 阅读全文
posted @ 2015-08-24 23:31 不会起昵称 阅读(764) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 maxnode为区间长度的三倍 3 调用: 4 tree.update(1, 1, n); 5 tree.query(1, 1, n, 0); 6 n为区间长度,[y11, y22]为维护或查询区间,v为增加值或修改值 7 op == 1时区间加上v,op == 2时区间修改为v 8... 阅读全文
posted @ 2015-08-24 23:30 不会起昵称 阅读(1007) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionHere are n Candidates in one election. Every Candidate could vote any one (of course himself/herself). In this election, the one wh... 阅读全文
posted @ 2015-05-28 17:33 不会起昵称 阅读(133) 评论(0) 推荐(0) 编辑