| hebron-code-jam 2019 |
|---|
| Finished |
Given a tree of size $$$n$$$ and an integer $$$k$$$. Your task is to determine if the tree can be divided into k non-intersecting subtrees of the same size. Every node of the tree should belong to exactly one subtree.
The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n, k \leq 10^5$$$), the number of nodes in the tree and the number of subtrees after dividing the tree, respectively.
Each of the following $$$n - 1$$$ lines contains two integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_i,b_i \leq n$$$), representing an edge that connects the two nodes. It is guaranteed that the given graph is a tree.
Print "Yes" if it is possible to divide the tree into $$$K$$$ subtrees of the same size. Otherwise print "No".
4 2 1 2 2 3 3 4
Yes
5 2 5 1 5 2 5 3 3 4
No
| Name |
|---|


