| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 25 | 11 | 11 | 45.833% |
Little I and Little J are playing a game again.
Little J brings a tree with $n$ vertices. Each edge of the tree has two states: open and closed. Initially, all edges of the tree are open.
There is a chip initially placed at vertex 1ドル$. Little I can move the chip, and the goal is to move the chip to a vertex with degree exactly equal to 1ドル$. Little J can close edges of the tree with the goal of preventing Little I from moving the chip to a vertex with degree exactly 1ドル$. The degree of a vertex is the number of edges connected to it, regardless of whether they are open or closed.
The game consists of several rounds, each round having the following steps:
Little J wants to know who will win if Little I and Little J know the structure of this tree and are extremely smart.
The first line contains a single integer $n$ (1ドル \le n \le 10^5$) representing the number of vertices in the tree.
Then follow $n - 1$ lines, each containing two integers $u$ and $v$ (1ドル \le u, v \le n$) representing two vertices connected by an edge of the tree.
If Little I wins, print 1. Otherwise, print 0.
6 1 2 2 3 2 4 1 5 5 6
0
7 1 2 2 3 2 4 1 5 5 6 5 7
1