Minimum spanning tree variation [HELP]

Правка en2, от Aritra741, 2019-08-10 09:20:41

Given a graph with n(<=100) vertices and m( <=n(n-1)/2 ) edges, you are asked to find a spanning tree with the minimum difference between the biggest and the smallest edge of the tree.

The problem can be found Here (UVA 1395). I can't figure out an efficient way to solve this. Any kind of help is appreciated.

Update: Got AC using fake123_loves_me's approach. this is my code if anyone is interested.

Теги mst, dsu

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Aritra741 2019-08-10 09:20:41 138
en1 Английский Aritra741 2019-08-09 20:19:21 457 Initial revision (published)