#P4123. [CQOI2016] 不同的最小割
[CQOI2016] 不同的最小割
Description
Students who have studied graph theory all know the concept of the minimum cut: For a graph, a partition of the nodes divides all nodes into two parts. If nodes are not in the same part, then the partition is called a cut with respect to . For a weighted graph, the capacity of a cut is defined as the sum of the weights of edges whose endpoints lie in different parts, and the minimum cut is the cut of minimum capacity among all cuts with respect to .
For contestants preparing for the NOI, finding the minimum cut between two nodes in a weighted graph is no longer difficult. Let us broaden the view: In an undirected connected graph with nodes, consider the minimum cut capacity for every unordered pair of nodes. In total we obtain values. How many of these values are distinct? This seems like an interesting problem.
Input Format
The first line contains two integers , the number of nodes and the number of edges.
Each of the next lines contains three integers , indicating there is an edge between node and node (indexed from ) with weight .
Output Format
Output a single integer on the first line, the number of distinct minimum cut capacities.
4 4
1 2 3
1 3 6
2 4 5
3 4 4
3
Hint
Constraints: , , .
Translated by ChatGPT 5
京公网安备 11011102002149号