kimTH65 / Coding

Coding Practice
0 stars 0 forks source link

코딩 문제 풀이 25(AtCoder) - Python #25

Open kimTH65 opened 10 months ago

kimTH65 commented 10 months ago

AtCoder Beginner Contest 360

C - Move It image

kimTH65 commented 4 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)