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.
x = int(input())
n = list(map(int, input().split()))
c = int(input())
data = [tuple(map(int, input().split())) for _ in range(c)]
amount=0
for i in range(0,c):
if data[i][0] in n:
amount+=data[i][1]
n.remove(data[i][0])
else:
continue
print(amount)
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 →
x = int(input()) n = list(map(int, input().split())) c = int(input()) data = [tuple(map(int, input().split())) for _ in range(c)] amount=0 for i in range(0,c): if data[i][0] in n: amount+=data[i][1] n.remove(data[i][0]) else: continue
print(amount)