This documentation is automatically generated by online-judge-tools/verification-helper
package util
type UnionFind struct {
data []int
}
func NewUnionFind(n int) *UnionFind {
data := make([]int, n)
for i := range data {
data[i] = -1
}
return &UnionFind{
data: data,
}
}
func (uf *UnionFind) Root(x int) int {
if uf.data[x] < 0 {
return x
} else {
uf.data[x] = uf.Root(uf.data[x])
return uf.data[x]
}
}
func (uf *UnionFind) Family(x, y int) bool {
return uf.Root(x) == uf.Root(y)
}
func (uf *UnionFind) Size(x int) int {
return -uf.data[uf.Root(x)]
}
func (uf *UnionFind) Union(x, y int) {
rx := uf.Root(x)
ry := uf.Root(y)
if rx == ry {
return
}
if uf.Size(rx) < uf.Size(ry) {
rx = rx ^ ry
ry = rx ^ ry
rx = rx ^ ry
}
uf.data[rx] += uf.data[ry]
uf.data[ry] = rx
}Traceback (most recent call last):
File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/user_defined.py", line 68, in bundle
raise RuntimeError('bundler is not specified: {}'.format(str(path)))
RuntimeError: bundler is not specified: go-acl/util/unionfind.go