Sync solutions from hanyixuanten/luogu@a92069d

gitea-actions[bot] committed 2026-10-29 06:00:17 +00:00
1 parent 404b43ae09
commit a39e2b6a70
2 files changed
+17

No files matched your search

+16
@@ -0,0 +1,16 @@
# P3384 【模板】重链剖分 / 树链剖分 题解
重链剖分模板。习惯用线段树(也可以双 BIT)。
其中:
- [L13-48](../P3384.cpp#L13-49) 为维护区间和的线段树。
- [L49-59](../P3384.cpp#L49-60) 为 dfs1,处理 $dep, cnt, fa, son$。
- [L60-71](../P3384.cpp#L60-72) 为 dfs2,处理 $dfn, top$。
- [L72-80](../P3384.cpp#L72-81) 为路径加,上跳即可。
- [L81-90](../P3384.cpp#L81-91) 为路径查询,与修改是类似的。
- [L91-96](../P3384.cpp#L91-97) 为子树修改与查询,由于子树的 $dfn$ 序列是连续的,直接在线段树上修改即可。
接下来建议用树链剖分解决一些[简单题](https://www.luogu.com.cn/problem/list?type=luogu&page=1&tag=228&orderBy=difficulty&order=asc)。
[code](../P3384.cpp)
+1
@@ -19,6 +19,7 @@
- [[P2607|P2607]] - [[P2607|P2607]]
- [[P3199|P3199]] - [[P3199|P3199]]
- [[P3205|P3205]] - [[P3205|P3205]]
- [[P3384|P3384]]
- [[P3572|P3572]] - [[P3572|P3572]]
- [[P4342|P4342]] - [[P4342|P4342]]
- [[P6650|P6650]] - [[P6650|P6650]]