Tags:
create new tag
view all tags
int dfs(int now, int goal, int mx){ // max flow
  if(now == goal) return mx; vis[now] = 1; int temp;
  for(int i = 0; i < n + 2; i++) if(!vis[i] && flo[now][i] < cap[now][i])
    if((temp = dfs(i, goal, mx <? (cap[now][i] - flo[now][i]))))
      { flo[now][i] += temp, flo[i][now] -= temp; return temp; }
  return 0;
}
// do{ memset(vis, 0, sizeof(vis)); } while(dfs(n, n + 1, 2000000000));
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2005-11-18 - MatthewChan
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback