Open kimTH65 opened 10 months ago
N = int(input())
N_list = dict()
A = list(map(int,input().split()))
W = list(map(int,input().split()))
answer = 0
for i in range(N):
if A[i] in N_list :
if(N_list[A[i]] < W[i]):
answer +=N_list[A[i]]
N_list[A[i]] = W[i]
else :
answer += W[i]
else :
N_list[A[i]]= W[i]
print(answer)
AtCoder Beginner Contest 360
C - Move It