-1

Problem Statement
You are given a weighted undirected graph G with N vertices, numbered 1 to N. Initially, G has no edges.
You will perform M operations to add edges to G. The i-th operation (1≤i≤M) is as follows:
You are given a subset of vertices Si={Ai,1, Ai,2, ,…,Ai,Ki} consisting of Ki verti...