2021 ECNU Campus Invitational Contest |
---|
Закончено |
Cuber QQ know an Edge Game, in which two players move their tokens on edges alternatively. Specifically, the game starts with a fixed and given undirected tree. Player A and Player B each has a token on one node. They move in turn. In each step, the player moves his/her own token to a node adjacent to the current node located. Player A moves first. The player who first moves his/her token on the other's wins. Determine if A can win if each plays optimally.
In the first line there is one integer $$$n\;(2\le n\le 10^5)$$$, representing the number of nodes in the tree.
In each of the next $$$n-1$$$ lines are two integers $$$u,v\;(1\le u,v\le n,\; u\neq v)$$$ each, representing there is an edge between node $$$u$$$ and node $$$v$$$.
In the last line are two integers $$$a,b\;(1\le a,b\le n,\; a\neq b)$$$, representing the node A's token and B's token is on initially.
One line "Yes" or "No", denoting the winner.
3 1 2 1 3 1 3
Yes
3 1 2 1 3 2 3
No
Название |
---|