luogu#P7841. 「C.E.L.U-03」100%不公平的游戏
「C.E.L.U-03」100%不公平的游戏
Background
Today, ice went out to have fun. Bob, who originally planned to play a game with Alice, can only play a game of strategy with Al.
Problem Description
This game is played on a tree. Bob moves first. Bob and Al take turns doing the following operation. The first player who cannot make a move loses.
- Mark an unmarked edge on the tree. It must satisfy that after each operation, there exists a simple path that traverses all marked edges. Note that this simple path may pass through unmarked edges.
If the given tree has a winning strategy for Bob, output Play now; otherwise output Restart.
Input Format
This problem has multiple test cases. The first line contains an integer indicating the number of test cases.
For each test case, the first line contains an integer indicating the number of nodes in the tree.
The next lines each contain two integers indicating that is an edge of the tree.
Output Format
For each test case, output a string. The output is case-sensitive.
2
9
9 5
2 1
9 8
3 2
5 6
7 9
4 3
5 2
3
1 2
2 3
Play now
Restart
附加两组样例详见
https://www.luogu.com.cn/paste/b6mh7ido
附加两组样例详见
https://www.luogu.com.cn/paste/b6mh7ido
Hint
The sample testdata can also be found in the attachment .
Sample Explanation 1
Test case 1:
If the first player chooses edge , they can guarantee a win:
If the second player chooses , the first player can choose to win.
If the second player chooses , the first player can choose to win.
If the second player chooses , the first player can choose to win.
If the second player chooses , the first player can choose to win.
If the second player chooses , the first player can choose to win.
If the second player chooses , the first player can choose to win.
If the second player chooses , the first player can choose to win.
In summary, no matter which edge the second player chooses, they will not be able to win.
Test case 2:
The first player has no winning strategy:
If the first player chooses , the second player chooses and wins.
If the first player chooses , the second player chooses and wins.
Sample Explanation 2
The details of each test case are shown in the figure below. The first two test cases are the same as in Sample 1.

Constraints
The testdata guarantees that the given graph is a tree.
Subtasks
- (8 points) .
- (18 points) .
- (6 points) .
- (8 points) .
- (30 points) .
- (6 points) There are at most two nodes with degree greater than .
- (12 points) The tree is a perfect binary tree.
- (12 points) No special properties.
Translated by ChatGPT 5