Problem : GCD and MST

Revision en1, by strange14, 2022-02-10 17:09:26

My solution involving prim's algorithm 145857604 gives wrong answer for this problem : 1513D - GCD and MST I understand the Kruskal's algorithm solution mentioned in the editorial, but cannot figure out why prims is failing here.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English strange14 2022-02-10 17:09:26 261 Initial revision (published)