We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
collections.Counter()
collections.Counter()
Sort by
recency
|
1361 Discussions
|
Please Login in order to post a comment
nShoes = int(input()) nSizes = input().split() nSizes = list(map(lambda x: int(x), nSizes)) nCust = int(input()) totalEarnings = 0 for _ in range(nCust): preferSizePrice = input().split() preferSizePrice = list(map(lambda x: int(x), preferSizePrice)) if preferSizePrice[0] in nSizes: nSizes.remove(preferSizePrice[0]) totalEarnings += preferSizePrice[1] print(totalEarnings)
from collections import Counter
no_of_shoes = int(input()) shoe_size = map(int, input().split()) cus = int(input())
earnings = 0
shop = Counter(shoe_size)
for i in range(cus): cus_shoe_size,price = map(int, input().split()) if shop[cus_shoe_size] > 0: shop[cus_shoe_size] -= 1 earnings += price print(earnings)