CF609E Minimum spanning tree for each edge
Description
Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains $ n $ vertices and $ m $ edges.
For each edge $ (u,v) $ find the minimal possible weight of the spanning tree that contains the edge $ (u,v) $ .
The weight of the spanning tree is the sum of weights of all edges included in spanning tree.
Input Format
First line contains two integers $ n $ and $ m $ ( $ 1
Output Format
Print $ m $ lines. $ i $ -th line should contain the minimal possible weight of the spanning tree that contains $ i $ -th edge.
The edges are numbered from $ 1 $ to $ m $ in order of their appearing in input.