Vaccination
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 2.0 s
Memory Limit: 256.0 MB
Description
Dr Strange has a tree of \(N\) nodes which is infected by x-virus. Luckily he has a vaccine for this virus.
The vaccine can be injected to the tree through any single node. But there is a problem, the vaccine spreads too slow. It takes one day to reach all neighbour of a vaccinated node at a time. The tree will be healed only if the vaccine is spread to all the nodes.
Dr Strange wants his tree to be healed as soon as possible. So he came to you for help. You have to tell him what is the minimum number of days needed for the tree to be healed and which node is suitable to inject the vaccine in tree.
if there are multiple such nodes print the node with biggest number.
Input
First line takes one number \(N\) : number of nodes
next \(N\)-1 lines each takes two integer \(u,v\) : it means node \(u\) has an edge with \(v\)
\(1 <= N <= 2*10^5\)
Output
Print two integer : minimum number of days and a suitable node.
NOTE : Use new line after printing your answer
Sample
Input | Output |
---|---|
|
|
Brain Booster #4
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 9
- Start at
- 2024-07-14 15:30
- End at
- 2024-07-14 19:00
- Duration
- 3.5 hour(s)
- Host
- Partic.
- 89