#P4214. [CERC2015] Juice Junctions
[CERC2015] Juice Junctions
Description
You are hired to upgrade an old juice factory’s orange juice transport system. The system consists of pipes and nodes. Each pipe is bidirectional, and each pipe has a flow rate of liter per second. Pipes connect nodes, and each node can be connected to at most pipes. Nodes have infinite capacity. Nodes are labeled by integers through . Before the upgrade, you need to analyze the existing system. For two distinct nodes and , the – flow is defined as the maximum flow from to when is the source and is the sink.
In the first sample below, the flow from to is , and the flow from to is .
Compute the sum of – flows over all pairs of nodes with .
Input Format
The first line contains integers and (, ), denoting the number of nodes and the number of pipes.
Each of the next lines contains two distinct integers (), indicating that there is a pipe connecting nodes and .
Each node is incident to at most pipes, and there is at most one pipe between any pair of nodes.
Output Format
Output a single integer: the sum of – flows over all pairs with .
6 8
1 3
2 3
4 1
5 6
2 6
5 1
6 4
5 3
36
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号