arrow_forward
همه ارسالها
جزئیات ارسال کد#311
برای پسندیدن وارد شوید
1
2n = int(input())
3houses = map(int, input().split())
4
5houselist = [0] * n
6value = 0
7magic = 0
8
9for h in houses:
10 value += magic
11 if houselist[h - 1] == 0:
12 magic += 1
13 houselist[h - 1] = 1
14 elif houselist[h - 1] == 1:
15 magic -= 1
16
17value += magic
18print(value)
کد ارسالشده برای داوری خودکار هاتکدز
UTF-8