Selecting items from two arrays without duplicate indices to get maximum sum
There are two ways to interpret the problem. 

$k$ is part of the input

Let $a=(a_1, a_2, \cdots, a_n)$ and $b=(b_1, b_2, \cdots, b_n)$ be the two given array. Suppose we have chosen $k$ values from array $a$, $a_i$ where $i$ ranges over some index set $I$ that has $k$ elements. Then we have to choose the $n-k$ values from array $b$, $b_j$ where $j$ ranges over all indices that are not in $I$. The sum of all numbers are

$$\sum_{i\in I}a_i+\sum_{i\not\in I}b_i=(\sum_{i\in I}a_i-\sum_{i\in I}b_i) + (\sum_{i\in I}b_i+\sum_{i\not\in I}b_i)=\sum_{i\in I}(a_i-b_i)+\sum_ib_i$$

Since $\sum_ib_i$ is a constant, the sum reaches the maximum if $\sum_{i\in I}(a_i-b_i)$ reaches the maximum. So we can select the $k$ largest elements in the array $a-b=(a_1-b_1, a_2-b_2, \cdots, a_n-b_n)$. The indices of the those elements are the indices of the elements in $a$ that we should choose. 

The $k$ largest element can be selected in $O(n)$ time using quickselect, this algorithm can be implemented in $O(n)$ time. It can also be implemented in $O(n\log n)$ easily by sorting the array $a-b.$

$k$ is not part of the input

Solve the previous problem  for $k=0$. Let the maximum sum obtained by $m_0$.
Solve the previous problem again but for $k=1$. Let the maximum sum obtained by $m_1$.
And so on.   

Find the maximum number among $m_0, m_1, \cdots, m_n$. That is the maximum sum we want in this interpretation the problem. A bit of extra bookkeeping will let us know the numbers we should select to reach that maximum sum.

Exercises

Exercise 1. How about the case of smallest sum?

Exercise 2. How about exactly $k-1$ values from the first array and $n-k$ values from the other array?