Difficulty in solving CNTTREE from SPOJ.

algorithm
graph

#1

I was looking attempting the problem CNTTREE from SPOJ, but I am completely clueless on how to solve such problems. I don’t even understood the sample test case.

This problem is also there on codechef, I looked at the editorial but appeared very overwhelming.

Can anyone please explain how to solve this problem, with the background of such problems.


#2

// I don’t even understood the sample test case.
Make sure you know the definition of Diameter of a tree, as well the meaning of a subtree.


#3

@sorb1997

Can you please explain.


#4

@vivek_1998299 @vijju123

Can you please check this out?