From 229d6a72d5b98ba8f0e1c5ffc6260ead96925697 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Sun, 2 Jul 2023 21:29:49 +0200 Subject: [PATCH] Relocation --- relocation.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 relocation.py diff --git a/relocation.py b/relocation.py new file mode 100644 index 0000000..89c016f --- /dev/null +++ b/relocation.py @@ -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]))