摘要: 单(single): 题干: 题解: t=0时,考虑DP,我们可推出树结点与子结点b数组的关系, $ b[x]=b[fa]-sum[i]+tot-sum[i]\\b[i]=b[fa]+tot-2*sum[i] $ 显然我们可两次$dfs$求解。 t=1时,由上式得,$ b[i]-b[fa]=tot- 阅读全文
posted @ 2019-07-29 06:39 Toot_Holmes 阅读(165) 评论(1) 推荐(1)