You are viewing a single comment's thread. Return to all comments →
from collections import Counter X = int(input()) shoes = Counter(map(int,input().split())) # "4 5 6 7 7" # ["4","5","6","7","7"] # [4,5,6,7,7] # {4:1,5:1,6:1,7:2} N = int(input()) earned = 0 for i in range(N): size,price= map(int,input().split()) if shoes[size] > 0: shoes[size]-=1 earned += price print(earned)
collections.Counter()
You are viewing a single comment's thread. Return to all comments →