Consider a tree with
nodes numbered from 1 to
,
rooted at 1. Each node
has a natural label
.
Given two nodes
and
,
define
as the exclusive or (^ in C++) of all the
in the path from
to
.
Let be the set of leaves of the tree. Please compute .
Input consists of several trees, each with the number of nodes , followed by , followed by pairs of nodes describing the edges of the tree. Assume , and .
For each tree, print the required sum.
Author: Ángel García
Generation: 2026-01-25T11:12:53.826Z
© Jutge.org, 2006–2026.
https://jutge.org