From 1fbce31cddb6be2346bdda91a138608c1c8ef3f8 Mon Sep 17 00:00:00 2001 From: "gitea-actions[bot]" Date: Thu, 29 Oct 2026 06:04:43 +0000 Subject: [PATCH] Sync solutions from hanyixuanten/luogu@43d9b98 --- P1453.md | 4 ++-- P2607.md | 2 +- P3384.md | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/P1453.md b/P1453.md index ea20664..1b6c7bf 100644 --- a/P1453.md +++ b/P1453.md @@ -2,6 +2,6 @@ 题意可转化为有一棵树,每个节点有权值,一个边两端的点不能同时去,同时 $S, T$ 也不能同时取(断开环上的两个点)。 -因此可转化两次为[P1352 没有上司的舞会](https://www.luogu.com.cn/problem/P1352#),设 $f_{i, 01}$ 以 $i$ 为根的子树,是否选择本节点的收益,只需[以 $S$ 为根时令 $f_{T, 1} = -\inf$,以 $T$ 为根时令 $f_{S, 1} = -\inf$ 即可。](../P1453.cpp#L17-L19) +因此可转化两次为[P1352 没有上司的舞会](https://www.luogu.com.cn/problem/P1352#),设 $f_{i, 01}$ 以 $i$ 为根的子树,是否选择本节点的收益,只需[以 $S$ 为根时令 $f_{T, 1} = -\inf$,以 $T$ 为根时令 $f_{S, 1} = -\inf$ 即可。](../P1453.cpp#L17-L18) -[code](../P1453.cpp) \ No newline at end of file +[code](../P1453.cpp) diff --git a/P2607.md b/P2607.md index 7c6f1f0..05b8904 100644 --- a/P2607.md +++ b/P2607.md @@ -6,6 +6,6 @@ 本题与[P1453](../P1453.md)的区别是形成的不只是一个树+断边,而是一个森林+断边。 -只需要将 [P1453 的并查集](../P1453.cpp#L35-L42)改为[保存 $S, T$ vector](../P2607.cpp#L33-L40),随后对于每个树+断边仿照 P1453 的实现即可 +只需要将 [P1453 的并查集](../P1453.cpp#L35-L41)改为[保存 $S, T$ vector](../P2607.cpp#L33-L39),随后对于每个树+断边仿照 P1453 的实现即可 [code](../P2607.cpp) diff --git a/P3384.md b/P3384.md index c818090..41e8b81 100644 --- a/P3384.md +++ b/P3384.md @@ -4,12 +4,12 @@ 其中: -- [L13-48](../P3384.cpp#L13-L49) 为维护区间和的线段树。 -- [L49-59](../P3384.cpp#L49-L60) 为 dfs1,处理 $dep, cnt, fa, son$。 -- [L60-71](../P3384.cpp#L60-L72) 为 dfs2,处理 $dfn, top$。 -- [L72-80](../P3384.cpp#L72-L81) 为路径加,上跳即可。 -- [L81-90](../P3384.cpp#L81-L91) 为路径查询,与修改是类似的。 -- [L91-96](../P3384.cpp#L91-L97) 为子树修改与查询,由于子树的 $dfn$ 序列是连续的,直接在线段树上修改即可。 +- [L13-48](../P3384.cpp#L13-L48) 为维护区间和的线段树。 +- [L49-59](../P3384.cpp#L49-L59) 为 dfs1,处理 $dep, cnt, fa, son$。 +- [L60-71](../P3384.cpp#L60-L71) 为 dfs2,处理 $dfn, top$。 +- [L72-80](../P3384.cpp#L72-L80) 为路径加,上跳即可。 +- [L81-90](../P3384.cpp#L81-L90) 为路径查询,与修改是类似的。 +- [L91-96](../P3384.cpp#L91-L96) 为子树修改与查询,由于子树的 $dfn$ 序列是连续的,直接在线段树上修改即可。 接下来建议用树链剖分解决一些[简单题](https://www.luogu.com.cn/problem/list?type=luogu&page=1&tag=228&orderBy=difficulty&order=asc)。