arrow_forward همه ارسال‌ها

جزئیات ارسال کد#411

verified
وضعیت داوری نهایی: پاسخ نادرست تست 3
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
AmirHosein (۲ سال پیش)
descriptionsolution.py ۲۰ خط • ۴۷۵ بایت
1n = int(input())
2inp = list(map(int, input().split()))
3wire_cost = [0] * n
4seen = [False] * n
5again = [False] * n
6
7for i in range(2*n):
8 num = inp[i]-1
9 if seen[num] == False:
10 seen[num] = True
11 elif seen[num] == True and again[num] == False:
12 for j in range(len(seen)):
13 if seen[j] == True:
14 wire_cost[j] += 1
15 if seen[num] == True:
16 again[num] = True
17
18
19
20print(sum(wire_cost))
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8