We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f45fe1 commit 3db3b04Copy full SHA for 3db3b04
max-flow.md
@@ -307,14 +307,14 @@ def path_cost(path):
307
def find_path(s):
308
dist[s] = 0
309
310
- for i in range(n - 1):
+ for i in range(n - 1): # <-- не делаем последнюю итерацию
311
312
for e in network_edges():
313
v = source(e)
314
u = target(e)
315
c = cost(e)
316
317
- if available(e) == 0:
+ if dist[v] is None or available(e) == 0:
318
continue
319
320
if dist[u] is None or dist[u] > dist[v] + c:
@@ -379,7 +379,7 @@ def remove_cycles(s):
379
def find_cycle(s):
380
381
382
- for i in range(n):
+ for i in range(n): # <-- делаем последнюю итерацию
383
384
385
0 commit comments