首页 > TAG信息列表 > CF343D

CF343D Water Tree

\(Solution:\) 树链剖分模板题,分两种问题维护 区间覆盖+单点查询 路径覆盖 \(Code:\) #include<bits/stdc++.h> #define int long long #define lson p<<1 #define rson (p<<1)|1 using namespace std; inline int read() { int x=0,f=1;char c=getchar(); while(c<

CF343D Water Tree

CF343D Water Tree 写珂朵莉树也就图一乐呵,要真冲还是要写线段树 题目给你一颗有根树,一个操作是将一个子树状态推平,另一个是将一个点到根的路径推平。 第一个操作直接区间覆盖\([dfn[u],dfn[u] + size[u] - 1]\)即可。 第二个操作按重链一直跳上去,遇到连续的就区间覆盖即可。 区间

【CF343D】 Water Tree(树链剖分)

题目链接 树剖傻逼题,练练手好久没写树剖了。 查询忘记\(pushdown\)抓了好久虫。。 全文手写,一遍过。。。 #include <cstdio> const int MAXN = 500010; inline int read(){ int s = 0, w = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-

【CF343D】Water Tree(树链剖分)

大水题 #include<bits/stdc++.h> const int N=500005; using namespace std; template<class T> inline void read(T &x) { x=0; int f=1; static char ch=getchar(); while(!isdigit(ch)) {if(ch=='-') f=-1;ch=getchar();} while(isdigit(ch))