题目描述:
Lady CA has a tree with n points numbered
1,2,…,n, and each edge has its weight. The unique route
connecting two points is called a chain, and the length of a chain
equals the sum value of the weights of the edges passed.
The point number m is called the root. Lady CA
defines a special kind of chain called folded chain, the chain
connecting the points numbered x,y(x≠y) is called a
folded chain, if and only if the chain connecting the point numbered
x and the root doesn’t pass the point numbered
y, and the chain connecting the point numbered
y and the root doesn’t pass the point numbered
x.
Lady CA wants to find the length of the kth longest
folded chain. Notice that the chain connecting the points numbered
x,y and the chain connecting the points numbered
y,x are the same.