You are viewing a single comment's thread. Return to all comments →
from collections import Counter if __name__ == "__main__": X = map(int, input()) sizes = list(map(int, input().split())) N = int(input()) demand = [list(map(int, input().split())) for i in range(N)] income = 0 sizes = Counter(sizes) for size,price in demand: if sizes[size] != 0: income += price sizes[size] -= 1 print(income)
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 →