Difference: Code_MaximumFlowShort (1 vs. 3)

Revision 32005-11-18 - MatthewChan

Line: 1 to 1
 
META TOPICPARENT name="ProgrammingContest"
int dfs(int now, int goal, int mx){ // max flow

Revision 22005-11-18 - MatthewChan

Line: 1 to 1
 
META TOPICPARENT name="ProgrammingContest"
int dfs(int now, int goal, int mx){ // max flow
Line: 10 to 10
 } // do{ memset(vis, 0, sizeof(vis)); } while(dfs(n, n + 1, 2000000000));
Changed:
<
<
>
>
 

Revision 12005-11-17 - YuryKholondyrev

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="ProgrammingContest"
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));
 
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