Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kzrnm committed Dec 19, 2020
1 parent fb3df2d commit ed45c72
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Source/AtCoderLibrary/Graph/MaxFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ TValue Dfs(int v, TValue up)
_g[v][iter[v]].Cap = op.Add(_g[v][iter[v]].Cap, d);
_g[e.To][e.Rev].Cap = op.Subtract(_g[e.To][e.Rev].Cap, d);
res = op.Add(res, d);
if (res.Equals(up)) break;
if (res.Equals(up)) return res;
}

level[v] = _n;
return res;
}

Expand All @@ -283,12 +283,9 @@ TValue Dfs(int v, TValue up)
{
iter[i] = 0;
}
while (op.LessThan(flow, flowLimit))
{
var f = Dfs(t, op.Subtract(flowLimit, flow));
if (op.Equals(f, default)) break;
flow = op.Add(flow, f);
}
var f = Dfs(t, op.Subtract(flowLimit, flow));
if (op.Equals(f, default)) break;
flow = op.Add(flow, f);
}
return flow;
}
Expand Down

0 comments on commit ed45c72

Please sign in to comment.