Pairs in Tree

Limits: 833h20m0s, 512 MB

You will be given a tree of N nodes. Each node has a given value and the distance between adjacent nodes is 1 unit. Now you have to find how many pair of nodes exists whose sum will be 0 and the distance between them will be less than L.

This is a companion discussion topic for the original entry at