You are viewing a single comment's thread. Return to all comments →
from collections import *
num_of_shoes=int(input()) shoe_sizes=list(map(int,input().split())) cust=int(input())
total=0 for i in range(cust): a,b=input().split() if int(a) in shoe_sizes: total+=int(b) shoe_sizes.remove(int(a))
print(total)
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 →
from collections import *
num_of_shoes=int(input()) shoe_sizes=list(map(int,input().split())) cust=int(input())
total=0 for i in range(cust): a,b=input().split() if int(a) in shoe_sizes: total+=int(b) shoe_sizes.remove(int(a))
print(total)