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

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

verified
وضعیت داوری نهایی: محدودیت زمان تست 12
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Mujtablue io (۳ سال پیش)
descriptionsolution.py ۱۳ خط • ۳۶۹ بایت
1n = int(input())
2houses = list(map(int, input().split()))
3wires = 0
4
5for plaque in range(1, n + 1):
6 index = houses.index(plaque)
7 sec_index = list(reversed(houses)).index(plaque)
8 sec_index += len(houses) - 1 - sec_index * 2
9 distance = sec_index - index
10 wires += distance
11else:
12 del plaque, index, sec_index, distance
13 print(wires)
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8