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
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 

sailemaverit:
20151105 07:04:10
I have solved this problem, getting a 100 in the result.


Osama Fathy:
20151017 21:30:02
I am confused!


(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
20150809 14:26:11
@hoc sinh test: do the kid even care about spanning trees? :p 

hoc sinh test:
20150723 15:41:32
Problem for kids :D Last edit: 20150723 17:17:08 

Ðức Tân:
20150723 12:41:22
dễ vãi :D 

computer science:
20150710 10:04:38
easy 

tarunsai:
20150620 08:48:21
if we get 18.18 is it correct or not

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 