#P14455. [ICPC 2025 Xi'an R] Imagined Holly
[ICPC 2025 Xi'an R] Imagined Holly
题目描述
Given a non-negative integer matrix of size . For a tree with vertices, numbered from to , we call it a if and only if:
- For any pair of vertices and (), equals the bitwise XOR sum of the indices of the vertices on the simple path from to in the tree.
Your task is to construct a holly tree. It is guaranteed that such a holly tree always exists.
输入格式
The first line of the input contains an integer (), which is the size of matrix .
The next lines of the input describe the matrix . The -th line contains integers (). Note that holds for all .
It is guaranteed that such a holly tree always exists.
输出格式
Output lines, each containing two integers and (), representing an edge of the holly tree.
2
1 3
2
1 2
4
1 3 2 5
2 0 7
3 6
4
1 2
1 3
1 4
6
1 7 4 5 2 3
2 1 6 7 0
3 5 4 3
4 3 2
5 5
6
4 1
2 3
6 4
5 2
4 2
提示
In the second example, the tree in the output is shown in the following figure:
:::align{center}
:::
This tree is a holly tree. For example, for the pair of vertices , the simple path from to includes vertices , and , with a bitwise XOR sum of , which satisfies the constraint given in the input.
京公网安备 11011102002149号