You are viewing a single comment's thread. Return to all comments →
Using a function to organize the input:
# Enter your code here. Read input from STDIN. Print output to STDOUT from collections import Counter
def get_input(convert_func=int): return list(map(convert_func, input().split()))
input() shoe_inventory = Counter(get_input()) num_cust = int(input())
income = 0 for _ in range(num_cust): size, price = get_input() if shoe_inventory[size]: income += price shoe_inventory[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 →
Using a function to organize the input:
# Enter your code here. Read input from STDIN. Print output to STDOUT from collections import Counter
def get_input(convert_func=int): return list(map(convert_func, input().split()))
input()
shoe_inventory = Counter(get_input()) num_cust = int(input())
income = 0 for _ in range(num_cust): size, price = get_input() if shoe_inventory[size]: income += price shoe_inventory[size] -= 1
print(income)