. Note that for any two vertices there is exactly one single path between them, whereas a simple path doesn't contain any edge more than once. The length of a simple path is considered as the number of edges in it.You need to pick up a simple path whose length is not smaller than. Vbe the set of vertices in the simple path. You need to calculate the maximum of
A tree with n n vertices is a connected undirected graph with n n vertices and n-1 n−1 edges. You are given a tree with n n vertices. Each vertex has a value b_i b i . Note that for any two vertices there is exactly one single path between them, whereas a simple path doesn't contain any edge more than once. The length of a simple path is considered as the number of edges in it. You need to pick up a simple path whose length is not smaller than 1 1 and select a real number x x. Let V V be the set of vertices in the simple path. You need to calculate the maximum of frac{sum_{uin V}(-x^2+b_{u}x)}{|V|} ∣V∣ ∑ u∈V (−x 2 +b u x) .