![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
吴俊达9812
这个作者很懒,什么都没留下…
展开
-
bzoj 3631
树上差分裸题 #include<bits/stdc++.h> using namespace std; typedef int lint; const int maxn = 300000 + 5; const int maxm = 600000 + 5; lint a[maxn],ver[maxm],he[maxn],ne[maxm],tot,ans[maxn],val[maxn]...原创 2019-06-21 14:27:13 · 86 阅读 · 0 评论 -
洛谷P1600 天天爱跑步
树上的题有点意思啊 这题我最开始的想法是 固定一个观测点i,能观测到的一定是起点距离 i 为 w[ i ] 的点的子集合。问题是这个集合只有一部分的点会经过 i 点,就很烦。。。 于是得换个思路,不放固定一个跑步的人 x 观察他对哪些观察者 i 产生了贡献。 于是我们得到了公式, 对于上升阶段的点来说,不妨设 s 为起点 d[x]+w[x] = d[s]( d为表示深度的数组 )...原创 2019-06-22 14:01:31 · 167 阅读 · 0 评论