随笔分类 -  图论——树链剖分

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