#P10583. [蓝桥杯 2024 国 A] 异或路径
[蓝桥杯 2024 国 A] 异或路径
Problem Description
Given a tree with nodes, numbered from to . For each node with index , there is an edge to the node with index , and the edge weight is .
Define the value of a path as the XOR sum of the weights of all edges on this path. If two paths contain different edges, they are considered different paths. Find the product of the values of all essentially different simple paths in this tree (excluding those with value ), and output the answer modulo .
Input Format
The input contains one line with one integer .
Output Format
Output one line with one integer representing the answer.
5
36
Hint
For of the testdata, .
For of the testdata, .
For all testdata, .
Translated by ChatGPT 5