mkmojo / aoapc-book

Automatically exported from code.google.com/p/aoapc-book
1 stars 0 forks source link

刘老师您好,我想问一下书中dinic代码的cur数组功能 #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
 只有这几处有涉及该数组
{{{
// UVa11248 Frequency Hopping:使用Dinic算法

  int cur[maxn];   // 当前弧指针
//=====================
  while(BFS()) {
      memset(cur, 0, sizeof(cur));
      flow += DFS(s, INF); 
    }

//=====================
 for(int& i = cur[x]; i < G[x].size(); i++) {
}}}

该数组自始至终都为0,请问它是怎么起到 
当前弧指针的作用的?谢谢

Original issue reported on code.google.com by lz1996...@gmail.com on 12 May 2013 at 7:37

GoogleCodeExporter commented 8 years ago
看了下网上的代码,是不是应该在bfs时记录cur数组?

Original comment by lz1996...@gmail.com on 12 May 2013 at 8:06

GoogleCodeExporter commented 8 years ago
注意这个:`int& i = 
cur[x]`,因为i是cur[x]的引用,所以i变化的时候cur[x]也会跟着��
�化 :)

Original comment by rujia....@gmail.com on 12 May 2013 at 12:58

GoogleCodeExporter commented 8 years ago
谢谢,对c++不是很熟

Original comment by lz1996...@gmail.com on 13 May 2013 at 10:30

GoogleCodeExporter commented 8 years ago

Original comment by rujia....@gmail.com on 3 Sep 2013 at 4:57