Tap here to switch tabs
Problem
Submissions

Problem: Maximize Points After Choosing K Tasks

Maximize Points After Choosing K Tasks gives two point arrays for completing each task with one of two techniques. Choose every task and use the first technique for at least k tasks to maximize total points.

Statement

You are given two integer arrays, technique1 and technique2, each of length n, and an integer k.

There are n tasks. For each task i, you can choose to complete it using technique 11 to receive technique1[i] points, or using technique 22 to receive technique2[i] points.

You must complete at least k tasks using technique 11. Every task must be completed using exactly one of the two techniques.

Return the maximum total points you can accumulate after completing all n tasks.

Constraints:

  • 1≤n==1 \leq n == technique1.length ==== technique2.length ≤105\leq 10^5

  • 1≤1 \leq technique1[i], technique2[i] ≤105\leq 10^5

  • 0≤0 \leq k ≤n\leq n

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximize Points After Choosing K Tasks

Maximize Points After Choosing K Tasks gives two point arrays for completing each task with one of two techniques. Choose every task and use the first technique for at least k tasks to maximize total points.

Statement

You are given two integer arrays, technique1 and technique2, each of length n, and an integer k.

There are n tasks. For each task i, you can choose to complete it using technique 11 to receive technique1[i] points, or using technique 22 to receive technique2[i] points.

You must complete at least k tasks using technique 11. Every task must be completed using exactly one of the two techniques.

Return the maximum total points you can accumulate after completing all n tasks.

Constraints:

  • 1≤n==1 \leq n == technique1.length ==== technique2.length ≤105\leq 10^5

  • 1≤1 \leq technique1[i], technique2[i] ≤105\leq 10^5

  • 0≤0 \leq k ≤n\leq n