神秘小标题。 https://www.luogu.com.cn/problem/P4383 树形 dp。f_{u ,0/1/2} 表示到了点 u,没选/挂起/闭合的含代价最佳值。上 wqs。 https://www.luogu.com.cn/problem/P15916 有题解。