https://www.codechef.com/viewsolution/14477354
Approach:
I am storing the weight on the path from node 1 to each node .
and finally xor the weights on the path .
I coded for this problem using your approach and its giving tle for the sigabrt case as expected because if there are more than even 1000 nodes in path u to v then it should give tle due to the time constraints.
check my soln.
Reason for tle is your dfs, as the = operator you used in it to store the weight’s vector has linear time complexity and thus in worst case it goes beyond acceptable time limit and thus the TLE.
https://www.codechef.com/viewsolution/14609805
Hope this helps.