你小子(指指点点)
by ShieHere @ 2023-07-25 15:00:30
复杂度正确啊。
- 遍历 $n$ 个点,$\mathcal O(n)$;
- 遍历 $m$ 个点,$\mathcal O(m)$。
总时间 $\mathcal O(n+m)$。
@[Let_Fly](/user/760859)
by denominator @ 2023-07-26 09:14:45
@[denominator](/user/174009) 没有,在dfs里我的vis是设而未用的
by Let_Fly @ 2023-07-26 11:54:23
哦,那好吧,确实这时间是 $\mathcal O(n^2+nm)$ 的。
by denominator @ 2023-07-26 12:09:30