#K75242. Sum of Distinct Minimums
Sum of Distinct Minimums
Sum of Distinct Minimums
You are given an integer n and two arrays A and B each containing n integers. Your task is to update the array A by replacing each element A[i] with min(A[i], B[i]) for all 0 ≤ i < n and then compute the sum of all distinct values in the updated array. The final result should be printed to stdout.
Note: The arrays may contain repeated elements. You must ensure that each distinct value is only added once to the final sum.
The input will be provided via stdin and the output should be printed to stdout.
inputFormat
The first line of input is an integer n which denotes the size of the arrays. The second line contains n space-separated integers representing the array A, and the third line contains n space-separated integers representing the array B.
outputFormat
Print a single integer which is the sum of the distinct values in the updated array A after replacing each element with min(A[i], B[i]).
## sample5
3 4 7 6 5
2 1 5 6 4
18