1842f

CF1842F Tenzing and Tree 题解

Tenzing and Tree 感觉很典型的题,就是树的重心+绝对值等式 解法: 以每个点 \(i\) 为根分别 \(bfs\) ,得到一个距离数组 \(dis\) ,取前 \(k\) 个值的权值为和,更新 \(w[k]\) 的值, \(n\) 个点分别为根,更新 \(n\) 遍之后,得到 \(w ......
题解 Tenzing 1842F 1842 Tree

【CF1842F】Tenzing and Tree

# 题目 题目链接:https://codeforces.com/contest/1842/problem/F 给定一棵 $n$ 个点的树,你可以选择其中 $k$ 个点染黑,定义一条边的价值为割去这条边之后,剩下两颗树的黑点数量差;一棵树的价值为所有边的价值之和。 对于 $k\in [0,n]$,求 ......
Tenzing 1842F 1842 Tree and

CodeForces 1842F Tenzing and Tree

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842F "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/F "CF 传送门") 事实上自己方向一直是错的…… 绝对值不好弄,我一开始的 ......
CodeForces Tenzing 1842F 1842 Tree
共3篇  :1/1页 首页上一页1下一页尾页