You are viewing a single comment's thread. Return to all comments →
Solved using counter
from collections import Counter def counter_results(): no_of_shoes = int(input()) shoe_size_list = list(map(int, input().split(' '))) num_of_shoe_size_dict = Counter(shoe_size_list) customer_numbers = int(input()) earned_money = 0 for _ in range(customer_numbers): size, price = list(map(int, input().split(" "))) if size in shoe_size_list and num_of_shoe_size_dict[size] != 0: num_of_shoe_size_dict[size] -= 1 earned_money += price print(earned_money) if __name__ == "__main__": counter_results()
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 →
Solved using counter