You are viewing a single comment's thread. Return to all comments →
import collections X = int(input()) shoe_sizes = list(map(int, input().split())) shoefreq_list = dict(collections.Counter(shoe_sizes)) N = int(input()) total_amount = 0 for i in range(N): shoe_size, price = map(int, input().split()) if(shoe_size in shoefreq_list.keys() and shoefreq_list[shoe_size] > 0): total_amount += price shoefreq_list[shoe_size] -= 1 print(total_amount)
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 →
For Python3 Platform