This documentation is automatically generated by competitive-verifier/competitive-verifier
# competitive-verifier: PROBLEM https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_B
from libs.potential_unionfind import PotentialUnionFind
from libs.standard_input import il
N, Q = il()
PUF = PotentialUnionFind(N)
while Q:
l = il()
if l[0] == 0:
x, y, z = l[1:]
PUF.unite(x, y, z)
else:
x, y = l[1:]
if not PUF.same(x, y):
print("?")
else:
print(PUF.diff(x, y))
Q -= 1
Env | Name | Status | Elapsed | Memory |
---|---|---|---|---|
Python | 00_sample_00.in |
![]() |
32 ms | 12 MB |
Python | 01_small_00.in |
![]() |
30 ms | 12 MB |
Python | 02_corner_00.in |
![]() |
30 ms | 12 MB |
Python | 03_general_00.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_00.in |
![]() |
28 ms | 12 MB |
Python | 04_rand_01.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_02.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_03.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_04.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_05.in |
![]() |
30 ms | 12 MB |
Python | 04_rand_06.in |
![]() |
31 ms | 12 MB |
Python | 04_rand_07.in |
![]() |
30 ms | 12 MB |
Python | 05_large_00.in |
![]() |
100 ms | 14 MB |
Python | 05_large_01.in |
![]() |
142 ms | 12 MB |
Python | 06_maximum_00.in |
![]() |
281 ms | 15 MB |
Python | 06_maximum_02.in |
![]() |
276 ms | 15 MB |
Python | 07_dense_00.in |
![]() |
59 ms | 12 MB |
Python | 07_dense_01.in |
![]() |
88 ms | 12 MB |
Python | 07_dense_02.in |
![]() |
177 ms | 13 MB |
Python | 07_dense_03.in |
![]() |
278 ms | 16 MB |
Python | 08_shell_00.in |
![]() |
570 ms | 16 MB |
Python | 09_extreme_line_00.in |
![]() |
581 ms | 16 MB |
Python | 09_extreme_same_00.in |
![]() |
546 ms | 14 MB |
Python | 09_extreme_same_01.in |
![]() |
577 ms | 15 MB |