Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

anshu2002's blog

By anshu2002, history, 2 months ago, In English

There is a tree of N nodes and a integer k.In one operation you can do the following . Choose a node X other than the root node. If the distance between root and the parent of X is less than that of X ( where 1<=X<=N ) . Then X will be disconnected from it's original parent and X will be directly get connected to root. Height of the tree is the maximum distance from root to any node of tree . So find the minimum height of the tree after applying the above operation at most K times

EDIT 1 : THIS TREE IS ROOTED AT 1 AND EDGES ARE UNDIRECTED INPUT FORMAT: First line contains N and K . Next N-1 line contains two integers u and v denoting that there is an edge between u and v

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by anshu2002 (previous revision, new revision, compare).