Information
hiho! is a serial contests we developed to help programmers improve their skills following some architecture. Tree, as a data structure, has a significant feature that the problem on a tree usually can be divided in to several sub-problems on sub-trees which is very similar to what we have learned in "Dynamic Programming".
After weeks of telling you guys that segment-tree can solve this problem, let's just see how Ho uses the segement-tree to solve it!