Z42

Maximum Performance of a Team

Staff / Principal Engineer
Target Time: 40 - 50 Minutes
Type: NUMERIC

Problem Statement & Objective

Choose at most k engineers from n candidates to maximize the team performance: sum(speed) * min(efficiency).

Function Signature (Python)

maximum_performance_of_a_team(n: int, speed: list[int], efficiency: list[int], k: int) -> int

Input & Output Contract

Output Rule:Maksimum performans mod 1_000_000_007.

System Constraints

1 <= k <= n <= 10^5
hiz.length == verimlilik.length == n
1 <= hiz[i], verimlilik[i] <= 10^8

Example Execution Walkthrough

n = 6, hiz = [2, 10, 3, 1, 5, 8], verimlilik = [5, 4, 3, 9, 7, 2], k = 2
hız 10 (verim 4) ve hız 5 (verim 7) -> (10 + 5) * min(4, 7) = 15 * 4 = 60

Example Test Scenarios (3)

Example 1
Input:[6,[2,10,3,1,5,8],[5,4,3,9,7,2],2]
Expected Output:60
Example 2: k=3
Input:[6,[2,10,3,1,5,8],[5,4,3,9,7,2],3]
Expected Output:68
Example 3: k=1
Input:[3,[1,2,3],[3,2,1],1]
Expected Output:4
Loading Python Editor...
Input Parameters
[
  6,
  [
    2,
    10,
    3,
    1,
    5,
    8
  ],
  [
    5,
    4,
    3,
    9,
    7,
    2
  ],
  2
]
Expected Output
60