Vaccination
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 |
---|---|
|
|
Information
- ID
- 1069
- Difficulty
- 7
- Category
- (None)
- Tags
- (None)
- # Submissions
- 86
- Accepted
- 19
- Accepted Ratio
- 22%
- Uploaded By
Related
In following contests: