Recently I have come across a problem of an IUPC contest, where the problem asks for the summation of the mex value of all subtrees of a tree for each vertex where the vertex is the root of the tree. The detailed statement is given below or can be found in I-Mexy.
Statement Can anyone give me hints or provide any resources about this topic?