Farmer John's farm consists of
Thus, his plan is to partition the set of roads into several paths, and delegate responsibility for each path to a worthy farm hand. To avoid contention, he wants each path to be the same length. He wonders for which lengths there exists such a partition.
More precisely, for each
Subtask # | Score | Constraints |
---|---|---|
1 | 21 | The tree forms a star; at most one vertex has degree greater than two. |
2 | 29 | |
3 | 50 | No additional constraints |
The first line contains a single integer
The next
Output a bit string of length
Sample Input 1 | Sample Output 1 |
13
|
111000000000
|
It is possible to partition this tree into paths of length
Subtask | Score |
---|---|
1 | 21 |
2 | 29 |
3 | 50 |
4 | 0 |