![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树链剖分
guoshiyuan484
这个作者很懒,什么都没留下…
展开
-
树链剖分模板
spoj 375 #include #include #include using namespace std; int seg[40000]; int medge[10010]; struct edgee { int from, to, cost; edgee(int f, int t, int c) :from(f), to(t), cost(c) {} edgee() {} };原创 2017-09-26 13:08:43 · 155 阅读 · 0 评论 -
树链剖分bzoj3626
渐渐的我也能1a了哈哈哈!!!!!(立个flag只要我1a的题,题解就写详细点) 比如说一颗树 1-2 2-3 2-4 3-5现在叫你求lca(5,4)的deep 你阔以这样求 先树链剖分,然后从1到5的点上的value都加1(当然初始化的时候每个点上的value=0),这样做的目的在于将深度进行转化,那么现在就相当于让你求1-4这条路径上的value和,嗯,现在问题得到了转化,就阔以加线段树了原创 2017-09-29 13:15:50 · 191 阅读 · 0 评论