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
bhedavivek:
20161019 19:56:16
A little help pls, new to SPOJ


hung:
20161013 08:28:52
Fucking Long long == 

avengers_2:
20160829 22:47:48
why i am getting 36.36 only 

sshuvo:
20160811 20:52:51
"17486414 20160811 20:48:49 sshuvo Minimum Spanning Tree 100 edit ideone it 0.08 "


mrinal_aich:
20160720 17:12:02
Got 100% in one go... 

roadblock:
20160328 07:19:46
@harshgupta007: check for integer overflow 

harshgupta007:
20160310 06:32:32
I am getting 81.82. I am using JAVA. Any help would be very appreciated....


gohanssj9:
20160203 16:40:52
Aman Gupta,


Sukeesh:
20160105 20:41:20
easy .. :) 

fallingstar:
20160103 01:45:36
@sailemaverit partial score problems don't count 
Added by:  Nikola P Borisov 
Date:  20081020 
Time limit:  1s2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JS NODEJS PERL 6 VB.net 