Skip to main content
Code Review

Return to Question

added 79 characters in body
Source Link
Aicody
  • 244
  • 1
  • 8

You are given a subset of vertices Si=Si={Ai,1, AiAi,1,2 Ai,2, ,...,Ai,KiAi,Ki} consisting of KiKi vertices. For every pair u,v such that u,v ∈ SiSi and u<v, add an edge between vertices u and v with weight CiCi.

After performing all M operations, determine whether G is connected. If it is, find the total weight of the edges in a minimum spanning tree of G.

You are given a subset of vertices Si={Ai,1, Ai,2, ,...,Ai,Ki} consisting of Ki vertices. For every pair u,v such that u,v ∈ Si and u<v, add an edge between vertices u and v with weight Ci. After performing all M operations, determine whether G is connected. If it is, find the total weight of the edges in a minimum spanning tree of G.

You are given a subset of vertices Si={Ai,1, Ai,2, ,...,Ai,Ki} consisting of Ki vertices. For every pair u,v such that u,v ∈ Si and u<v, add an edge between vertices u and v with weight Ci.

After performing all M operations, determine whether G is connected. If it is, find the total weight of the edges in a minimum spanning tree of G.

added 61 characters in body
Source Link
Aicody
  • 244
  • 1
  • 8

Code:

The code runs okay. Ideone

Code

Code:

The code runs okay. Ideone

edited tags
Link
Toby Speight
  • 87.3k
  • 14
  • 104
  • 322
Source Link
Aicody
  • 244
  • 1
  • 8
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /