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 |
![]() |
31 ms | 12 MB |
Python | 01_small_00.in |
![]() |
29 ms | 12 MB |
Python | 02_corner_00.in |
![]() |
28 ms | 11 MB |
Python | 03_general_00.in |
![]() |
28 ms | 12 MB |
Python | 04_rand_00.in |
![]() |
28 ms | 12 MB |
Python | 04_rand_01.in |
![]() |
28 ms | 12 MB |
Python | 04_rand_02.in |
![]() |
28 ms | 12 MB |
Python | 04_rand_03.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_04.in |
![]() |
29 ms | 11 MB |
Python | 04_rand_05.in |
![]() |
31 ms | 11 MB |
Python | 04_rand_06.in |
![]() |
31 ms | 11 MB |
Python | 04_rand_07.in |
![]() |
31 ms | 12 MB |
Python | 05_large_00.in |
![]() |
155 ms | 14 MB |
Python | 05_large_01.in |
![]() |
225 ms | 12 MB |
Python | 06_maximum_00.in |
![]() |
500 ms | 15 MB |
Python | 06_maximum_02.in |
![]() |
472 ms | 16 MB |
Python | 07_dense_00.in |
![]() |
88 ms | 12 MB |
Python | 07_dense_01.in |
![]() |
119 ms | 12 MB |
Python | 07_dense_02.in |
![]() |
313 ms | 12 MB |
Python | 07_dense_03.in |
![]() |
480 ms | 16 MB |
Python | 08_shell_00.in |
![]() |
902 ms | 16 MB |
Python | 09_extreme_line_00.in |
![]() |
949 ms | 16 MB |
Python | 09_extreme_same_00.in |
![]() |
973 ms | 14 MB |
Python | 09_extreme_same_01.in |
![]() |
1098 ms | 15 MB |