You are viewing a single comment's thread. Return to all comments →
from collections import Counter x = int(input().strip()) shoes = list(map(int, input().split())) shoe_counter = Counter(shoes) N = int(input().strip()) revenue = 0 for i in range(N): size, price = map(int, input().split()) if shoe_counter[size] > 0: revenue+=price shoe_counter[size] -= 1 elif shoe_counter[size] == 0: del shoe_counter[size] revenue +=0 print(revenue)
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 →