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 |
|
27 ms | 12 MB |
| Python | 01_small_00 |
|
25 ms | 12 MB |
| Python | 02_corner_00 |
|
25 ms | 12 MB |
| Python | 03_general_00 |
|
25 ms | 12 MB |
| Python | 04_rand_00 |
|
25 ms | 12 MB |
| Python | 04_rand_01 |
|
25 ms | 12 MB |
| Python | 04_rand_02 |
|
25 ms | 12 MB |
| Python | 04_rand_03 |
|
25 ms | 12 MB |
| Python | 04_rand_04 |
|
25 ms | 12 MB |
| Python | 04_rand_05 |
|
26 ms | 12 MB |
| Python | 04_rand_06 |
|
27 ms | 12 MB |
| Python | 04_rand_07 |
|
27 ms | 12 MB |
| Python | 05_large_00 |
|
146 ms | 14 MB |
| Python | 05_large_01 |
|
223 ms | 12 MB |
| Python | 06_maximum_00 |
|
556 ms | 15 MB |
| Python | 06_maximum_02 |
|
440 ms | 15 MB |
| Python | 07_dense_00 |
|
87 ms | 12 MB |
| Python | 07_dense_01 |
|
116 ms | 12 MB |
| Python | 07_dense_02 |
|
252 ms | 12 MB |
| Python | 07_dense_03 |
|
466 ms | 16 MB |
| Python | 08_shell_00 |
|
1075 ms | 16 MB |
| Python | 09_extreme_line_00 |
|
947 ms | 16 MB |
| Python | 09_extreme_same_00 |
|
974 ms | 14 MB |
| Python | 09_extreme_same_01 |
|
1308 ms | 15 MB |