Help with problem about Graph Theory

Revision en2, by Masterkaiba, 2017-09-21 07:01:14

Hello all, So I came across this problem about Graph Theory and I am still not sure on how to solve this. https://vjudge.net/contest/78376#problem/B

I tried thinking about MST however what to do if in the final solution there are more than the number of connected components? MST will be taking the whole graph as a single component.

If talking about MST then, I think Kruskal might work, but not Prim. Am I right?

Tags graph, graph theory

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Masterkaiba 2017-09-21 07:01:14 84
en1 English Masterkaiba 2017-09-21 06:57:27 374 Initial revision (published)