| Whalica Cup (Round 2) |
|---|
| Finished |
"The so-called Shichieichou (Seven-Shadow Butterflies) are the fragments of human memory..."
"The 'memories' of those who left behind attachments or regrets during their lifetime exist in this world in the form of butterflies."
"...Even though they are just memories, these are things that should not remain in this world."
"Someone must guide them back to where they truly belong."
"This is the Yamanomatsuri (Mountain Festival), which has been managed by the Sorakado family for generations."
"...There is one specific memory that I must find, no matter what..."
To fulfill the duties of the Sorakado family and to find that indispensable memory, Sorakado Ao needs to guide the Shichieichou scattered across the mountain toward the "Mayoi no Tachibana" (The Lost Mandarin Orange) during the Yamanomatsuri.
The mountain paths of Torishirojima can be represented as a tree$$$^{\text{∗}}$$$ with $$$n$$$ nodes, rooted at node $$$1$$$. It is guaranteed that every leaf node in the tree has the same depth (i.e., the distance to the root).
Due to the rugged mountain paths and the deep night, Ao's movement must follow these rules:
To allow as many Shichieichou as possible to return, please tell Ao the maximum number of butterflies she can guide.
$$$^{\text{∗}}$$$A tree with $$$n$$$ vertices is an undirected connected graph with $$$n$$$ vertices and $$$n-1$$$ edges. A rooted tree is a tree in which one of the vertices is special and is called the root.
Each test contains multiple test cases. The first line contains an integer $$$T$$$ ($$$1 \le T \le 10^4$$$), representing the number of test cases.
For each test case:
It is guaranteed that the sum of $$$n$$$ over all test cases and the sum of $$$m$$$ over all test cases do not exceed $$$2 \times 10^5$$$. It is also guaranteed that the given edges form a tree, and that all leaf nodes have the same depth.
For each test case, output a single integer representing the maximum number of Shichieichou Ao can guide.
33 21 21 33 01 16 31 21 32 42 53 66 12 11 18 51 21 32 43 64 56 76 85 24 26 83 11 5
223
In the first test case, the tree is rooted at node $$$1$$$, and nodes $$$2$$$ and $$$3$$$ are both leaves. Starting from node $$$3$$$, one Seven-Shadow Butterfly can be guided at time $$$t=0$$$. Then, moving to node $$$1$$$, another butterfly can be guided at time $$$t=1$$$. Therefore, the answer is $$$2$$$.
| Name |
|---|


