#P6175. 无向图的最小环问题
无向图的最小环问题
Description
Given an undirected graph, find a cycle that contains at least vertices, with no repeated vertices on the cycle, and whose total edge length is minimal. This problem is called the minimum cycle problem in an undirected graph. In this task, you need to output the total edge weight of the minimum cycle. If there is no solution, output No solution..
Input Format
The first line contains two positive integers , representing the number of vertices and the number of edges.
The next lines each contain three positive integers , indicating that there is an edge of length between vertices and .
Output Format
Output the total edge weight of the cycle with the minimum total edge weight. If there is no solution, output No solution..
5 7
1 4 1
1 3 300
3 1 10
1 2 16
2 3 100
2 5 15
5 3 20
61
Hint
Sample explanation: one feasible solution is .
For of the testdata, .
For of the testdata, .
For of the testdata, , , .
The output for no solution includes a period.
Translated by ChatGPT 5
京公网安备 11011102002149号