class UnionFind:
def __init__(self, n):
self.father = list(range(n))
self.size = [1]
python 基于列表的并查集实现模板
最新推荐文章于 2023-08-23 22:25:19 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
class UnionFind:
def __init__(self, n):
self.father = list(range(n))
self.size = [1]