atcoder#AGC035C. [AGC035C] Skolem XOR Tree
[AGC035C] Skolem XOR Tree
Score : points
Problem Statement
You are given an integer . Determine if there exists a tree with vertices numbered to satisfying the following condition, and show one such tree if the answer is yes.
- Assume that, for each integer between and (inclusive), Vertex and have the weight . Then, for each integer between and , the bitwise XOR of the weights of the vertices on the path between Vertex and (including themselves) is .
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
If there exists a tree satisfying the condition in the statement, print Yes
; otherwise, print No
.
Then, if such a tree exists, print the edges of such a tree in the subsequent lines, in the following format:
Here each pair (, ) means that there is an edge connecting Vertex and . The edges may be printed in any order.
3
Yes
1 2
2 3
3 4
4 5
5 6
- The sample output represents the following graph:
1
No
- There is no tree satisfying the condition.