Good afternoon! Recently I faced the following problem: given k trees on n vertices, let p[i](a, b) be the distance from vertex a to vertex b in the i-th tree. It is necessary to find two vertices x and y such that p[0](x, y) + ... + p[k-1](x, y) is minimal (i.e. choose a pair of points such that the sum of the distances from one to the other across all trees will be minimal). As I understood, it is necessary to use centroid decomposition for the solution, but I don't quite understand how to apply it here :( If you have any ideas, write them in the comments. Thank you in advance!



