I stared at this for a bit and started thinking about sorting by reward1 descending, which was wrong.
Start by computing the difference (reward1 - reward2) for each task. Sort tasks by this difference in descending order and assign the top k tasks to person 1, the rest to person 2. This greedy approach maximizes total reward because it selects tasks where person 1 has the greatest relative advantage.
Pro tip: Mention that this is equivalent to minimizing the opportunity cost of assigning person 1 instead of person 2, and that the greedy choice is optimal due to the matroid structure of the problem.
Clarify that we need to assign exactly k tasks to person 1 and n-k to person 2 to maximize total reward. Each task has two possible rewards depending on assignee.
For each task i, calculate d_i = reward1_i - reward2_i. This represents the gain (or loss) from assigning task i to person 1 instead of person 2.
Sort tasks in descending order of d_i. Tasks with higher d_i are more beneficial to assign to person 1.
Select the first k tasks from the sorted list and assign them to person 1. Assign the remaining tasks to person 2.
Sum the rewards: for tasks assigned to person 1, add reward1_i; for others, add reward2_i. This yields the maximum total reward.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.