This commit is contained in:
1 parent
8d7ad8aa70
commit
197cb84114
1 file changed
+7
@@ -0,0 +1,7 @@
|
|||||||
|
# P1453 城市环路 题解
|
||||||
|
|
||||||
|
题意可转化为有一棵树,每个节点有权值,一个边两端的点不能同时去,同时 $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-19)
|
||||||
|
|
||||||
|
[code](../P1453.cpp)
|
||||||
Reference in new issue
Block a user