You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
358 B
16 lines
358 B
list1, list2, summa, summa2 = [], [], 0, 0
|
|
|
|
for l in open("input.txt", 'r').read().splitlines():
|
|
tup = [int(n) for n in l.split(' ')]
|
|
list1.append(tup[0])
|
|
list2.append(tup[1])
|
|
|
|
list1.sort()
|
|
list2.sort()
|
|
|
|
for i in range(len(list1)):
|
|
summa += abs(list1[i] - list2[i])
|
|
summa2 += list2.count(list1[i]) * list1[i]
|
|
|
|
print(summa)
|
|
print(summa2) |