Skip to content

Commit b7659ce

Browse files
authored
Update graph.rst
1 parent 4e3a217 commit b7659ce

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

graph.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,13 @@ ISAP
264264

265265
.. code-block:: cpp
266266
267+
void addedge(int u, int v, int c, int r = 0) {
268+
e[idx].u = v, e[idx].c = c, e[idx].next = p[u], p[u] = idx++;
269+
e[idx].u = u, e[idx].c = r, e[idx].next = p[v], p[v] = idx++;
270+
}
267271
//* bfs in the beginning to accelerate (+5%)
268272
int gap[N], lev[N], cur[N], pre[N];
269-
int sap(int s, int t) {
273+
int sap(int s, int t, int n) {
270274
clr(gap, 0), clr(lev, 0), memcpy(cur, p, sizeof p);
271275
int u, v, ret(0), step(inf), mi;
272276
gap[0] = n, u = pre[s] = s;
@@ -441,4 +445,4 @@ MinCut(UndirectedGraph)
441445
v[now] = v[--n];
442446
}
443447
return ret;
444-
}
448+
}

0 commit comments

Comments
 (0)