Problem: http://www.usaco.org/index.php?page=viewproblem2&cpid=102
Another user pointed out to me the similarity between this problem and one on the most recent January contest (http://www.usaco.org/index.php?page=viewproblem2&cpid=696). The latter problem can be solved using the combination of a preorder traversal and BIT.
I was wondering if it is possible to solve the former problem with a combination of a Segment Tree and DFS (closest possible method to a preorder traversal). The segment tree would use lazy propagation to update the range of edges, but I am not sure how to use a DFS in this situation.
Am I on a right track? If so, I would appreciate input on how to continue. If not, please point me to another possible solution.
Please help, and thanks in advance!