H |
All
Pairs Maximum Flow Input: Standard Input Output: Standard Output |
"We must respect the other fellow's religion,
but only in the sense and to the extent that we respect his theory that his
wife is beautiful and his children smart." |
H. L. Mencken
Given
a square, symmetric matrix of edge capacities, return a squre, symmetric matrix
of maximum flows.
In
other words, you have n nodes. Between each pair of nodes, there is a
pipe of a certain thickness (measured in liters per second, possibly zero). For
each pair of nodes, (A, B), return the the maximum speed at which fluid can be
pushed from node A to node B, in liters per second. Note that the flow for each
pair of nodes is maximized separately -- there is no need to push all n2
flows simultaneously.
4 2 0 2 2 0 6 0 1 1 0 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 1 0 |
Case #1: 0 2 2 0 Case #2: 0 3 2 2 2 2 3 0 2 2 2 2 2 2 0 2 2 2 2 2 2 0 2 2 2 2 2 2 0 2 2 2 2 2 2 0 Case #3: Case #4: 0 |
Problemsetter: Igor Naverniouk
Special Thanks: Per Austrin