树链剖分
zhhx2001
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
bzoj4196(树链剖分)
不难,但有一些细节 像这种代码量稍微大一些的题,代码比较密集,就要注意 a=a+b;是不是打成 #include #include #include #include #include #include #define debug(x) cout<<#x<<"="<<x<<endl using namespace std; const int N=400019; int to[N],pre原创 2016-07-25 11:49:06 · 436 阅读 · 0 评论 -
hdu4897(树链剖分)
启迪:果然,离成功就差一步,如果刚刚我放弃了,停下debug的步伐,那我终不会知道成功原来并不遥远,就在霎那间,在我执着的信念前它终会出现 题目:树链剖分,细节真多,思路有一些乱,不过只要把所有情况考虑上了就ok了 注意事项在代码中 #include #include #include #include #include #include #define debug(x) c原创 2016-07-25 18:39:19 · 537 阅读 · 0 评论 -
bzoj4034(树链剖分裸题)
用到了dfs序 以后注意到这样的数据范围直接开ll就可以,1过样例且1A,(^-^)V #include #include #include #include using namespace std; typedef long long ll; const int N=100005; inline int read() { int ans,f=1;char ch; while ((ch=g原创 2016-08-19 16:57:13 · 538 阅读 · 0 评论 -
树链剖分的学习
首先表示,以后算法,光看思路,尽量自己实现,大胆实现即可 不过不知道为什么,别的oj都a了,bzoj 却runtime了 好,对树链剖分有一点思路了 我的理解就是,把树拆成一条条链,把链连起来,用数据结构进行维护,几一般用线段树(多)或splay(相对少)维护 表示真练连代码能力,要注意细节 步骤: dfs1——找出各个节点的深度,父亲,重儿子 dfs2——通过已经知道的重儿子,进行原创 2016-05-22 14:27:00 · 307 阅读 · 0 评论 -
bzoj3631(树链剖分或树形dp)
树链剖分,没有把线段树数组开大4倍!,卡了我好长时间!!!! #include #include #include #include using namespace std; const int maxn=800009; struct aa { int to,pre; }edge[maxn]; struct bb { int add,l,r; }a[maxn*2]; in原创 2016-06-16 14:02:47 · 655 阅读 · 0 评论
分享