![](https://velog.velcdn.com/images%2Fy7y1h13%2Fpost%2Ff1d6e4ce-3336-4a2e-8255-ab33f9d9872b%2Fimage.png)
![](https://velog.velcdn.com/images%2Fy7y1h13%2Fpost%2F47d518f6-f7cf-4984-97cf-dc7c871205a0%2Fimage.png)
정말 간단하게 풀었다. a를 미리 정렬하고 for 문으로 a를 하나씩 꺼내온다. b는 가장 큰 것만 가져와서 곱해주고 결과에 더한 후 곱했던 수를 remove로 삭제한다
n = int(input())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
tot = 0
for i in a:
tot += max(b) * i
b.remove(max(b))
print(tot)