#include #include #include using namespace std; ///struct used to store edges struct Edge{ int from,to,weight; ///we need this operator for sorting. Compares only weight since this is the only thing we need (in most cases, if nothing else is said) bool operator < (const Edge &target)const{ return this->weight < target.weight; } }edges[100000]; int m,n; int dsuParent[10000]; vector >mst[10000]; void init(){ scanf("%d %d",&n,&m); ///we store the edges in an array since we need to sort them (only) and nothing else for(int i=0;i