#P10039. [CCPC 2023 北京市赛] 游戏
[CCPC 2023 北京市赛] 游戏
Problem Description
Little I and Little J are playing a game again.
Little J brings a tree with nodes. Each edge on the tree has two states: open and closed. Initially, every edge on the tree is open.
Initially, there is a token placed on node . Little I can move the token, and the goal is to move the token to a node whose degree is exactly . Little J can close edges on the tree, and the goal is to prevent Little I from moving the token to a node whose degree is exactly .
The game consists of several rounds. Each round has the following steps:
- Little I win check: If the token is on a node whose degree is exactly , then Little I wins. Otherwise, go to step 2.
- Little J action: Little J chooses one currently open edge and permanently closes it, then go to step 3. If there is no open edge at the moment, skip this action and go directly to step 3.
- Little I action: Little I chooses one open edge that is connected to the node where the token currently is, and moves the token to the other endpoint of this edge. If there is no such edge, Little J wins. Otherwise, start a new round and return to step 1.
Little J wants to know: if both Little I and Little J know the shape of the tree and are extremely smart, who will win.
Input Format
The first line contains an integer , denoting the number of nodes in the tree. The next lines each contain two integers , denoting an edge in the tree.
Output Format
If Little I wins, output You win, temporarily.. Otherwise, output Wasted..
6
1 2
2 3
2 4
1 5
5 6
Wasted.
7
1 2
2 3
2 4
1 5
5 6
5 7
You win, temporarily.
Hint
[Sample Explanation 1]
Little J's strategy is as follows:
- Little J closes , so Little I can only move to .
- Little J closes , so Little I has to move back to .
- Little J closes , so Little I cannot move.
Translated by ChatGPT 5