Loading docs/graph/flow/max-flow.md +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ 讲一下一些小细节。如果你是用邻接矩阵的话,反向边直接就是从 $table[x,y]$ 变成 $table[y,x]$ 。如果是常用的链式前向星,那么在加入边的时候就要先加入反向边。那么在用的时候呢,我们直接 $i\operatorname{xor}1$ 就可以了 ( $i$ 为边的编号)。为什么呢?相信大家都是知道 $\operatorname{xor}$ 的,那么我们在加入正向边后加入反向边,就是靠近的,所以可以使用 $\operatorname{xor}$ 。我们还要注意一开始的编号要设置为 $tot=1$ ,因为边要从编号 $2$ 开始,这样子 $\operatorname{xor}$ 对编号 $2,3$ 的边才有效果。 EK 算法的时间复杂度为 $O(n^2m)$ (其中 $n$ 为点数, $m$ 为边数)。效率还有很大提升空间。 EK 算法的时间复杂度为 $O(nm^2)$ (其中 $n$ 为点数, $m$ 为边数)。效率还有很大提升空间。 ```cpp #define maxn 250 Loading Loading
docs/graph/flow/max-flow.md +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ 讲一下一些小细节。如果你是用邻接矩阵的话,反向边直接就是从 $table[x,y]$ 变成 $table[y,x]$ 。如果是常用的链式前向星,那么在加入边的时候就要先加入反向边。那么在用的时候呢,我们直接 $i\operatorname{xor}1$ 就可以了 ( $i$ 为边的编号)。为什么呢?相信大家都是知道 $\operatorname{xor}$ 的,那么我们在加入正向边后加入反向边,就是靠近的,所以可以使用 $\operatorname{xor}$ 。我们还要注意一开始的编号要设置为 $tot=1$ ,因为边要从编号 $2$ 开始,这样子 $\operatorname{xor}$ 对编号 $2,3$ 的边才有效果。 EK 算法的时间复杂度为 $O(n^2m)$ (其中 $n$ 为点数, $m$ 为边数)。效率还有很大提升空间。 EK 算法的时间复杂度为 $O(nm^2)$ (其中 $n$ 为点数, $m$ 为边数)。效率还有很大提升空间。 ```cpp #define maxn 250 Loading