P820 Nodes from the Root
Nodes from the Root
题目描述
There is a binary tree with N nodes indexing from 0 to N-1, where 0 is the root. Each edge of the tree has an integer weight W. At first all the nodes could be reached from the root, through a sequence of edges. An integer threshold X (X >= 0) is used to close the edge, which means that all the edges whose weights are less than X will be closed. Given the tree and an integer Y, please find the minimum threshold X so that the number of nodes reachable from the root (including the root itself) is no more than Y.



