Wrong Answer in WEASELTX(SEPT17) when the answer matches what correct code gives

Hello

In “Weasel does Xor on Tree” I could not make even the simplest solution passing at least one test case - every of them gave “Wrong Answer”. But it gave the expected answer on the sample provided in the problem statement.

Now when code of successful submissions is available I compared their output to mine on one of test cases (from here https://discuss.codechef.com/questions/111054/wa-in-weaseltxsept17) and it’s the same, but it gets WA.

Does anybody have an idea what is wrong?

Problem statement: https://www.codechef.com/SEPT17/problems/WEASELTX

why you are assuming the edge is always directed from parent to child ?? but it is not mentioned anywhere in the question. There edge b/w u and v not necessarily v is child of u.

Wow… I didn’t think about it… Now it’s clear, but for some reason it didn’t cross my mind during the contest. How did you find this incorrect assumption? By reading the code?