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.
# Enter your code here. Read input from STDIN. Print output to STDOUTfromcollectionsimportCountershoes_num=int(input())shoes_size=list(map(int,input().split()))cus_num=int(input())seg=Counter(shoes_size)cus_demand=[]total_earn=0foriinrange(cus_num):cus_dem=list(map(int,input().split()))cus_demand.append(cus_dem)# add earning to the total earning if cus_dem[0] present in shoe size# remove a shoe sizeifcus_dem[0]inseg.keys()andseg[cus_dem[0]]!=0:total_earn+=cus_dem[1]seg[cus_dem[0]]-=1print(total_earn)
Cookie support is required to access HackerRank
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 →