#P10157. [LSOT-2] Tree and Xor
[LSOT-2] Tree and Xor
Problem Description
Given , you need to construct a rooted tree with nodes, rooted at , such that and the sequence is lexicographically smallest. Here, denotes the XOR operation.
Here, denotes the number of nodes connected to node , denotes the parent of node , and .
You need to output . If there is no solution, output .
Input Format
The first line contains a positive integer , indicating the number of queries.
In the next lines, each line contains a positive integer , indicating one query.
Output Format
Output lines in total. Each line contains one integer, the answer modulo .
2
2
3
2
-1
Hint
"This problem uses bundled tests."
- .
- .
- .
- , where is a natural number.
- No special constraints.
For all testdata, , .
Translated by ChatGPT 5