Given a tree, you have to remove exactly k edges.Now you get k+1 subtrees. Each has a diameter. You have to say x = maximum of all the diameters. Now you have to minimize x removing exactly k edges.he tree has 50,000 nodes. Can anybody help me with some idea so that I can find a way to solve it? T

I think the first problem from here is the same — http://codeforces.com/blog/entry/13378 :) You can take a look at the comments below :)