秋招模拟赛第28场|华为春招实习|2023.05.24
- Status
- Done
- Rule
- IOI
- Problem
- 3
- Start at
- 2023-6-16 19:00
- End at
- 2023-6-16 21:00
- Duration
- 2 hour(s)
- Host
- Partic.
- 20
No testdata at current.
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
这道题是洛谷P1352-没有上司的舞会一题的改版.具体做法是树形DP.
动态规划题目重点有两个:状态定义,状态转移.
状态定义
我们记dp[u][0/1]为当前以u为根节点的子树的最高维护成本,其中第二维度为0表示u根节点也被撤销,为1表示u根节点未被撤销.
本题属于以下题库,请选择所需题库进行购买