![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树链剖分
tkj666
这个作者很懒,什么都没留下…
展开
-
bzoj 1036
水题 裸树剖 线段树记录最大值与和。 代码: #include #include #include #include using namespace std; int n,num=0,en=0,tn=0,fst[30010],q; struct edge { int x,y,n; }e[60010]; struct tree { int l,r,lc,rc,c1,c2; }tr[60原创 2016-11-25 12:50:19 · 239 阅读 · 0 评论 -
bzoj 4999: This Problem Is Too Simple!
树链剖分+线段树原创 2017-09-05 13:34:32 · 285 阅读 · 0 评论 -
bzoj 3531: [Sdoi2014]旅行
题意:一棵树上,每个点有颜色和权值,多个更改和询问,求某种颜色在一条路径上的最大值或和。 题解:树剖,每种颜色开一个线段树,动态开点就好了。 代码:#include<cstdio> #include<cstring> #include<algorithm> using namespace std;int n,q,fst[100010],num=0,w[100010],c[100010],en=0原创 2017-09-20 09:16:45 · 224 阅读 · 0 评论