随笔分类 - 图论——树链剖分
摘要:好像复杂度来说不是正解……不加谜之优化(下叙)能被loj上的加强数据卡 cpp include include include include using namespace std; int n, m, hea[100005], cnt, uu[200005], fa[100005], siz[1
阅读全文
摘要:做了 [JSOI2008]Blue Mary开公司 以后发现这 tm 不就是个傻逼树剖+李超线段树吗,做了以后发现我才是傻逼……树剖竟然写错了……这题是我目前写过最长的代码了qwq cpp include include using namespace std; typedef long long
阅读全文
摘要:对每一个宗教建一棵线段树,然后树剖搞搞 cpp include include using namespace std; int n, m, w[100005], c[100005], uu, vv, hea[100005], cnt, dep[100005]; int fa[100005], to
阅读全文
摘要:维护区间左颜色值,右颜色值,颜色段个数。 cpp include include using namespace std; int n, m, uu, vv, ww, w[100005], wt[100005], qwq, idx[100005], hea[100005]; int cnt, dep
阅读全文
摘要:安装就把根节点到它全设为 1 删除就把以它为根的子树全设为 0 记得 标记初始化为 1 ,因为标记是 0 的情况也是要处理的。
阅读全文
摘要:纪念一下独立AC紫题。 最近在学树剖,就忘了差分了……所以效率比较低 cpp include include using namespace std; int n, uu, vv, a[300005], hea[300005], dep[300005], gnd[300005][21], qwq;
阅读全文
摘要:裸题 cpp include include using namespace std; typedef long long ll; int n, m, ecnt, hea[100005], dep[100005], top[100005], idx[100005], cnt; int fa[1000
阅读全文
摘要:强烈推荐 "这篇文章" ,一下子就看懂AC了。 cpp include include include using namespace std; typedef long long ll; struct Edge{ int too, nxt; }edge[200005]; int n, m, r,
阅读全文

浙公网安备 33010602011771号