This documentation is automatically generated by online-judge-tools/verification-helper
# verification-helper: PROBLEM https://judge.yosupo.jp/problem/unionfind
from py.unionfind import UnionFind
def main():
N, Q = map(int, input().split())
g = UnionFind(N)
for i in range(Q):
t, u, v = map(int, input().split())
if t == 0:
g.merge(u, v)
else:
print(1 if g.same(u, v) else 0)
if __name__ == "__main__":
main()
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/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 "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/onlinejudge_verify/languages/python.py", line 93, in bundle
raise NotImplementedError
NotImplementedError