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](https://toph.co/c/cuet-inter-university-codestorm-1-0).↵
↵
[Statement](/predownloaded/0f/1f/0f1f5c0caa992d75d4524d14c25aeac23292e2b4.png)↵
↵
Can anyone give me hints or provide any resources about this topic?
↵
[Statement](/predownloaded/0f/1f/0f1f5c0caa992d75d4524d14c25aeac23292e2b4.png)↵
↵
Can anyone give me hints or provide any resources about this topic?