You are viewing a single comment's thread. Return to all comments →
x = int(input()) shoe_sizes = list(map(int, input().split())) n = int(input()) l1 = [] for i in range(n): l1.append(list(map(int,input().split()))) from collections import Counter avail_shoe = Counter(shoe_sizes) cost = 0 for i in l1: if avail_shoe[i[0]] > 0: cost += i[1] avail_shoe[i[0]] = avail_shoe[i[0]] - 1 print(cost)
Seems like cookies are disabled on this browser, please enable them to open this website
collections.Counter()
You are viewing a single comment's thread. Return to all comments →