摘要: https://www.acwing.com/problem/content/1074/ $对于每个节点, 得到其最长路径和次长路径\ d_1 和\ d_2$​ \(最长路径\ d = d_1 + d_2\) #include <bits/stdc++.h> using namespace std; 阅读全文
posted @ 2021-01-30 23:22 phr2000 阅读(83) 评论(0) 推荐(0)
摘要: 链接 : https://www.acwing.com/problem/content/287/ 状态表示 \(f[u][0] : 表示不要 u 点的最大价值\) \(f[u][1] : 表示要 u 点的最大价值\) 状态计算 $ \begin f[u][1] &+= \sum f[j][u]\ f 阅读全文
posted @ 2021-01-30 23:10 phr2000 阅读(39) 评论(0) 推荐(0)