This website requires JavaScript.
Explore
Help
Sign In
hanyixuanten
/
luogu
Watch
1
Star
1
Fork
0
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
Files
54aa7ffc70c05c662373c401d95f2cde6c321067
luogu
/
solutions
/
P3384.md
T
hanyixuanten
54aa7ffc70
Check cpp / md pair / Check md headers (push)
Successful in 4s
Details
new file: solutions/P3384.md
2026-10-29 05:58:29 +00:00
787 B
Raw
Blame
History
P3384 【模板】重链剖分 / 树链剖分 题解
重链剖分模板。习惯用线段树(也可以双 BIT)。
其中:
L13-48
为维护区间和的线段树。
L49-59
为 dfs1,处理 $dep, cnt, fa, son$。
L60-71
为 dfs2,处理 $dfn, top$。
L72-80
为路径加,上跳即可。
L81-90
为路径查询,与修改是类似的。
L91-96
为子树修改与查询,由于子树的
dfn
序列是连续的,直接在线段树上修改即可。
接下来建议用树链剖分解决一些
简单题
。
code
Reference in new issue
View Git Blame
Copy Permalink