Files
kattis/relocation.py
2023-07-02 21:29:49 +02:00

9 lines
248 B
Python

n, q = map(int, input().split())
c = {x: y for x, y in enumerate(list(map(int, input().split())), start=1)}
for _ in range(q):
t, a, b = map(int, input().split())
if t == 1:
c[a] = b
elif t == 2:
print(abs(c[a] - c[b]))