Problem A. Pseudoforest
时间限制 5000 ms
内存限制 64 MB
In graph theory, a pseudoforest is an undirected graph in which every connected component has at most one cycle. The maximal pseudoforests of G are the pseudoforest subgraphs of G that are not contained within any larger pseudoforest of G. A pesudoforest is larger than another if and only if the total value of the edges is greater than another one’s.
输入数据
输出数据
Output the sum of the value of the edges of the maximum pesudoforest.
样例输入
复制
3 3
0 1 1
1 2 1
2 0 1
4 5
0 1 1
1 2 1
2 3 1
3 0 1
0 2 2
0 0
样例输出
$ Mathjax font initiator $