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 |
![]() |
29 ms | 12 MB |
Python | 02_corner_00.in |
![]() |
29 ms | 12 MB |
Python | 03_general_00.in |
![]() |
29 ms | 12 MB |
Python | 04_rand_00.in |
![]() |
29 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 |
![]() |
30 ms | 12 MB |
Python | 04_rand_04.in |
![]() |
30 ms | 12 MB |
Python | 04_rand_05.in |
![]() |
31 ms | 12 MB |
Python | 04_rand_06.in |
![]() |
33 ms | 12 MB |
Python | 04_rand_07.in |
![]() |
34 ms | 12 MB |
Python | 05_large_00.in |
![]() |
177 ms | 14 MB |
Python | 05_large_01.in |
![]() |
229 ms | 12 MB |
Python | 06_maximum_00.in |
![]() |
519 ms | 15 MB |
Python | 06_maximum_02.in |
![]() |
538 ms | 15 MB |
Python | 07_dense_00.in |
![]() |
73 ms | 12 MB |
Python | 07_dense_01.in |
![]() |
138 ms | 12 MB |
Python | 07_dense_02.in |
![]() |
251 ms | 12 MB |
Python | 07_dense_03.in |
![]() |
498 ms | 15 MB |
Python | 08_shell_00.in |
![]() |
1000 ms | 16 MB |
Python | 09_extreme_line_00.in |
![]() |
971 ms | 16 MB |
Python | 09_extreme_same_00.in |
![]() |
985 ms | 14 MB |
Python | 09_extreme_same_01.in |
![]() |
1082 ms | 15 MB |