byslib-python

This documentation is automatically generated by online-judge-tools/verification-helper modified by bayashi_cl

View the Project on GitHub bayashi-cl/byslib-python

:heavy_check_mark: tests/data/union_find.test.py

Depends on

Code

# verification-helper: PROBLEM https://judge.yosupo.jp/problem/unionfind
import sys
from typing import Callable

from byslib.data.union_find import UnionFindTree

sys.setrecursionlimit(10 ** 6)
sinput: Callable[..., str] = sys.stdin.readline


def main() -> None:
    n, q = map(int, sinput().split())
    uft = UnionFindTree(n)
    for _ in range(q):
        t, u, v = map(int, sinput().split())
        if t == 0:
            uft.union(u, v)
        else:
            print(1 if uft.same(u, v) else 0)


if __name__ == "__main__":
    main()
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.4/x64/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], 'release': True}).decode()
  File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/onlinejudge_verify/languages/python.py", line 80, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page