Files
luogu/solutions/P1453.md
T
hanyixuanten 197cb84114
Check cpp / md pair / Check md headers (push) Successful in 3s
new file: solutions/P1453.md
2026-10-27 09:44:55 +00:00

7 lines
506 B
Markdown

# 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)