You are viewing a single comment's thread. Return to all comments →
A simple solution
from collections import Counter input() map_shoes = Counter(map(int, input().split())) earned = 0 for _ in range(int(input())): size, price = map(int, input().split()) stock = map_shoes[size] if stock > 0: earned += price map_shoes[size] -= 1 print(earned)
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 →
A simple solution