上一页 1 2 3 4 5 6 7 8 9 ··· 20 下一页

2014年11月8日

Poj1470 Closest Common Ancestors LCA

摘要: LCA裸题。。#include#include#include#include#includeusing namespace std;const int maxn = 1111;int head[maxn];int len;struct Node{ int to; int next;}e[... 阅读全文

posted @ 2014-11-08 16:12 一个西瓜 阅读(150) 评论(0) 推荐(0)

Hdu4547CD操作离线lca

摘要: 题意:根目录能一次到达其任意子目录,子目录返回上一层目录需要一次,给出目录关系,问从某个目录到某个目录最少要多少步。操作数 ,就是起点到最近公共祖先的距离。然后讨论下,如果最近公共祖先等于终点,那么答案就是起点到祖先的高度差 ,否则就是高度差加一 。#include#include#include#... 阅读全文

posted @ 2014-11-08 16:00 一个西瓜 阅读(198) 评论(0) 推荐(0)

2014年11月7日

1036: [ZJOI2008]树的统计Count树链剖分

摘要: 虽然是水题一枚,但是在我的不懈努下,交了80几发,在突然有一天重写的情况下,竟然1a了。#include#include#include#include#include#includeusing namespace std;const int maxn = 33333;struct Node{ ... 阅读全文

posted @ 2014-11-07 15:21 一个西瓜 阅读(158) 评论(0) 推荐(0)

2014年11月6日

light1348Aladdin and the Return Journey树链剖分

摘要: 点更新模版题,线段树 建树的时候没写更新,交了几十次吧。#include#include#include#include#include#includeusing namespace std;#define lson l,mid,rt> 1; build(lson); build(rso... 阅读全文

posted @ 2014-11-06 20:08 一个西瓜 阅读(193) 评论(0) 推荐(0)

Problem 2082 过路费树链剖分

摘要: 裸题直接搞。#include#include#include#include#include#includeusing namespace std;#define lson l,mid,rt> 1; build(lson); build(rson);}void up(LL rt){ su... 阅读全文

posted @ 2014-11-06 00:42 一个西瓜 阅读(219) 评论(0) 推荐(0)

2014年11月5日

2243: [SDOI2011]染色树链剖分

摘要: 对于线段树的操作,维护左端值,维护右端值,维护种类数,更新的时候,如果左儿子的右端==右儿子的左端,种类数减一,剩下的就是细节了。#include#include#include#include#include#includeusing namespace std;#define lson l,mi... 阅读全文

posted @ 2014-11-05 21:19 一个西瓜 阅读(149) 评论(0) 推荐(0)

Poj3237Tree 树链剖分

摘要: 点更新 ,段更新, 段查询。 注意的是 线段树维护区间最大值 ,在反转的时候 不能直接取反,那样就变成了 当时的最小值。所以维护两个值,一个最小值 一个最大值 ,在进行反转操作的时候,取反并且交换两个值。#include#include#include#include#include#include... 阅读全文

posted @ 2014-11-05 17:03 一个西瓜 阅读(214) 评论(0) 推荐(0)

Poj2763Housewife Wind树链剖分

摘要: 边查询,点更新的模板题。#include#include#include#include#include#includeusing namespace std;typedef long long LL;const int maxn = 222222;struct Node{ int to;in... 阅读全文

posted @ 2014-11-05 15:29 一个西瓜 阅读(222) 评论(0) 推荐(0)

2014年11月4日

Hdu5087Revenge of LIS II简单dp

摘要: 有个坑点,就是转移的时候前面状态数量如果不同,后面即使从同一个点转移过来,也是不同的。#include#include#include#include#include#includeusing namespace std;typedef long long LL;const LL maxn = 11... 阅读全文

posted @ 2014-11-04 08:19 一个西瓜 阅读(138) 评论(0) 推荐(0)

Hdu5088Revenge of Nim II高斯消元

摘要: 比赛的时候不会写,但是网上有基本一样的题。出题水了。。这题把每个数拆成2进制,然后就和开关灯一样了。然后学了下高斯消元kuangbin大神的高斯消元模板。http://www.cnblogs.com/kuangbin/archive/2012/09/01/2667044.html#include#i... 阅读全文

posted @ 2014-11-04 08:17 一个西瓜 阅读(156) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 20 下一页

导航