![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Link Cut Tree
文章平均质量分 80
nlj1999
这个作者很懒,什么都没留下…
展开
-
2049: [Sdoi2008]Cave 洞穴勘测
完了真不会写LCT了。。。。。。。还是去做几个树剖压压惊#include#include#includeusing namespace std;const int N=10000+5;int fa[N],ch[N][2],st[N];bool rev[N];inline bool isroot(int x){ return ch[fa[x]][0]!=x&&ch[fa[x]原创 2015-12-16 19:54:34 · 284 阅读 · 0 评论 -
HUD4010 Query on The Trees
无事闲来写了一发LCT模板。然后发现我之前写的LCT各种坑,貌似不支持点权的样子。于是又找了一个LCT模板,貌似好长的样子。。。。。。。#include#include#includeusing namespace std;const int N=300000+5;int mx[N],v[N],add[N];int fa[N],ch[N][2];bool rev[N],r原创 2016-01-03 19:19:47 · 270 阅读 · 0 评论 -
BZOJ 2001: [Hnoi2010]City 城市建设
太神辣完全不会%%%%%%%%%%%%%%%%听说可以CDQ分治+LCT做,不过好像会被卡常数于是找到了网上的鬼畜题解,非常玄学的做法#include#include#include#includeusing namespace std;const int N=20000+5;const int M=50000+5;const int inf=1e9;typedef l原创 2016-04-01 16:07:38 · 1388 阅读 · 0 评论 -
BZOJ 3091: 城市旅行
link cut tree水题将树链看成序列,答案即为sigma(a[i]*i*(n-i+1))/C(n+1,2),分母显然不用维护,分子拆开来搞一搞就好了(维护信息的link cut tree的标记必须即时生效TAT否则会WA)#include#include#include#include#include#includeusing namespace std;#def原创 2016-05-14 15:44:03 · 384 阅读 · 0 评论