arrow_forward
همه ارسالها
جزئیات ارسال کد#747
برای پسندیدن وارد شوید
1n = int(input())
2houses = list(map(int, input().split()))
3
4position = {}
5total = 0
6
7for i, j in enumerate(houses, start=1):
8 if j not in position:
9 position[j] = i
10 else:
11 total += abs(i - position[j])
12
13print(total)
کد ارسالشده برای داوری خودکار هاتکدز
UTF-8