Advertisement

E. MST+LCA for each edge

阅读量:

题目传送门

Given an edge (u,v), calculate the minimal weight of a spanning tree containing (u,v).

The total weight of a spanning tree equals the aggregate of edge weights belonging to every edge within the spanning tree.

Input

The first line consists of two integers, denoted as n and m, where the range is defined by (where 1 ≤ n ≤ 2×10⁵ and similarly for m). This represents the count of vertices and edges within the graph.

Among the subsequent m lines,, each includes three integers u_i\,, v_i\,, w_i,, where u_i,, v_i,, $w_

全部评论 (0)

还没有任何评论哟~