Skip to content

Commit 00b47ed

Browse files
author
alirezakhm
authored
Bug fixed in max flow
1 parent c5cd5d3 commit 00b47ed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graph/max_flow_pushRelabel_O(V^3).cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void push(int u, int v){
1111
}
1212

1313
void relabel(int u){
14-
int d = inf;
14+
ll d = inf;
1515
forn(i, n){
1616
if (capacity[u][i] - flow[u][i] > 0)
1717
d = min(d, height[i]);
@@ -33,7 +33,7 @@ vi find_max_height_vertices(int s, int t) {
3333
return max_height;
3434
}
3535

36-
int max_flow(int s, int t){
36+
ll max_flow(int s, int t){
3737
height.assign(n, 0); height[s] = n;
3838
flow.assign(n, vi(n, 0));
3939
excess.assign(n, 0); excess[s] = inf;
@@ -52,7 +52,7 @@ int max_flow(int s, int t){
5252
}
5353
}
5454

55-
int max_flow = 0;
56-
forn(i, n) max_flow += flow[0][i];
55+
ll max_flow = 0;
56+
forn(i, n) max_flow += flow[s][i];
5757
return max_flow;
5858
}

0 commit comments

Comments
 (0)