Relocation

This commit is contained in:
2023-07-02 21:29:49 +02:00
parent 8dac52bae6
commit 229d6a72d5

8
relocation.py Normal file
View File

@@ -0,0 +1,8 @@
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]))