Submission under review : http://codeforces.me/contest/767/submission/24809891
For problem : http://codeforces.me/contest/767/problem/C
Which cases am I missing? I tried to implement the two conditions as given in the tutorial but the submission fails for test 9 (which is a large one, i cannot debug by viewing the case).
Thank you for your time and attention
in the editorial it was written:
To check the second option, let's write down all vertices v such that sv = x / 3 and there is no other u with su = x / 3 in the subtree of v
I think, you are not checking this correctly.