Distances
AtCoder Beginner Contest 201 E - Xor Distances
# E - Xor Distances [原题链接](https://atcoder.jp/contests/abc201/tasks/abc201_e) 题意:设dist(i,j)即i到j之间路径的异或和,求树上所有两点之间dist(i,j)的和 思路:dist(i,j) = dist(i,1)^ ......
[CF1794E] Labeling the Tree with Distances 题解
# [CF1794E] Labeling the Tree with Distances 题解 ## 题目描述 给你一个树,边权为 $1$。给定 $n-1$ 个数,你需要将这些数分配到 $n-1$ 个节点上。 一个点 $x$ 是好的,当且仅当存在一种分配方案,所有被分配数的点到 $x$ 的最短路径长 ......
Tree Distances I
# Tree Distances I ## 思路 先考虑只算节点 $1$ 的答案,我们发现如果要每个节点都这么算一次的话,绝对会![image](https://img2023.cnblogs.com/blog/2903414/202308/2903414-20230815201329562-731 ......
834. Sum of Distances in Tree (Hard)
Description 834. Sum of Distances in Tree (Hard) There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges. You are g ......