Python/이것이 취업을 위한 코딩 테스트다(with 파이썬)
이것이 취업을 위한 코딩테스트다 - 두 배열의 원소 교체
sophia02
2022. 7. 3. 21:49
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort(reverse=True)
for i in range(k):
if a[i] < b[i]:
a[i], b[i] = b[i], a[i]
else:
break
print(sum(a))