MST  Minimum Spanning Tree
Find the minimum spanning tree of the graph.
Input
On the first line there will be two integers N  the number of nodes and M  the number of edges. (1 <= N <= 10000), (1 <= M <= 100000)
M lines follow with three integers i j k on each line representing an edge between node i and j with weight k. The IDs of the nodes are between 1 and n inclusive. The weight of each edge will be <= 1000000.
Output
Single number representing the total weight of the minimum spanning tree on this graph. There will be only one possible MST.
Example
Input: 4 5 1 2 10 2 3 15 1 3 5 4 2 2 4 3 40 Output: 17
hide comments
master19:
20200320 06:01:19
What does 54.55 indicate ??


codebreaker_00:
20200305 12:07:11
O(logN)=0.57sec;


codebreaker_00:
20200305 09:40:30
Lite


coolio_1:
20200225 17:43:09
100 means you passed 100% test cases. :) 

hetp111:
20191219 22:15:52
Time without path compression: 0.64 sec


luka_:
20191114 21:07:13
nice


sajalagrawal14:
20190827 01:09:40
sol:


gourav_987:
20190719 19:44:50
first time got ac in one go.100:)) 

mostafa_fares5:
20190705 14:09:07
Last edit: 20190705 14:32:11 

bhavya_100000:
20190702 06:20:24
Kruskals. AC in one go 
Added by:  Nikola P Borisov 
Date:  20081020 
Time limit:  1s2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 