正文
增加 3 行删除 3 行
13 行未改动14151617181920212298 行未改动121122123124125126127128129111 行未改动全部展开24124224324424524624724824967 行未改动13 行未改动## Part 2. 分治与离线- 树链分块## Part 3. 图论- 树的中心98 行未改动### 冷门性质一$n$ 个节点的树,以 **任意** 节点为根的 **任意** dfs 序下排行 $\lceil \dfrac{n}{2} \rceil$ 的点的祖先链中 **一定包含** 重心。等价表达:重心的子树内一定包含 dfs 序排行 $\lceil \dfrac{n}{2} \rceil$ 的点。例题:- [P5666](https://www.luogu.com.cn/problem/P5666)111 行未改动全部展开if (son[p][1]) w[p] ^= w[son[p][1]], val[p] ^= val[son[p][1]] << 1 | w[son[p][1]];}void insert (int &p, int x, int dep) {if (!p) p = ++idx;if (dep > K) return w[p] ^= 1, void();insert(son[p][x & 1], x >> 1, dep + 1), pushup(p);}```67 行未改动13 行未改动14151617181920212298 行未改动121122123124125126127128129111 行未改动全部展开24124224324424524624724824967 行未改动13 行未改动## Part 2. 分治与离线- 树链分块## Part 3. 图论- 树的中心98 行未改动### 冷门性质一$n$ 个节点的树,以 **任意** 节点为根的 **任意** dfs 序下排行 $\lceil \dfrac{n}{2} \rceil$ 的点的祖先链中 **一定包含** 重心。等价表达:重心的子树内一定包含 dfs 序排行 $\lceil \dfrac{n}{2} \rceil$ 的点。例题:- [P5666](https://www.luogu.com.cn/problem/P5666)111 行未改动全部展开if (son[p][1]) w[p] ^= w[son[p][1]], val[p] ^= val[son[p][1]] << 1 | w[son[p][1]];}void insert (int &p, int x, int dep) {if (!p) p = ++idx;if (dep > K) return w[p] ^= 1, void();insert(son[p][x & 1], x >> 1, dep + 1), pushup(p);}```67 行未改动