| Hello 2026 |
|---|
| Finished |
This is the Easy version of the problem. The difference between the versions is that in this version, you are only required to find the minimum number of operations. You can hack only if you solved all versions of this problem.
You are given a rooted tree$$$^{\text{∗}}$$$ consisting of $$$n$$$ vertices numbered from $$$1$$$ to $$$n$$$, where the root has index $$$1$$$, and each vertex is initially white. Define $$$d_i$$$ as the distance from the root to the $$$i$$$-th vertex. You can perform the following operations any number of times:
$$$^{\text{∗}}$$$A tree is a connected graph without cycles. A rooted tree is a tree where one vertex is special and called the root.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$2\le n\le 2\cdot 10^5$$$) – the number of vertices in the tree.
The $$$i$$$-th following $$$n-1$$$ lines contain two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i,v_i\le n$$$, $$$u_i\neq v_i$$$) – the ends of the $$$i$$$-th edge.
It is guaranteed that the given edges form a tree.
It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$2\cdot10^5$$$.
For each test case, output the minimum number of operations on a new line.
1053 11 25 14 153 22 42 51 253 44 15 11 252 53 12 13 451 31 54 32 4132 13 24 25 46 37 18 59 610 411 712 813 10105 78 11 102 88 49 46 15 37 8107 63 76 97 19 85 13 109 21 41010 62 84 107 51 27 1010 99 17 3106 89 74 105 94 23 86 51 51 10
5443334443
In the first test case, $$$d_1=1$$$ and $$$d_2=d_3=d_4=d_5=2$$$. We can show that we must perform at least $$$5$$$ operations because there are no two nodes that can be operated on simultaneously.
In the second test case, we can show that the least number of operations required to color the full tree is $$$4$$$. One way to do so is to color nodes $$$1$$$ and $$$3$$$ in the same operation, and all $$$3$$$ other nodes in their own operations.
| Name |
|---|


