Problem
Submissions

Problem: Maximum Performance of a Team

Statement

You are given two integers, n and k, and two integer arrays, speed and efficiency, both of length n. There are n engineers numbered from 1 to n. The value speed[i] represents the speed of the i-th engineer, and efficiency[i] represents their efficiency.

To form a team with the maximum performance, you need to select at most k different engineers from the n engineers.

The performance of a team is calculated as follows:

The sum of the selected engineers’ speeds ×\times the minimum efficiency among the selected engineers

Return the maximum performance of the team. As the result can be a very large number, return it modulo (109+7)(10^9 + 7).

Constraints:

  • 1≤1 \leq k ≤\leq n ≤103\leq 10^3

  • speed.length ==== n

  • efficiency.length ==== n

  • 1≤1 \leq speed[i] ≤103\leq 10^3

  • 1≤1 \leq efficiency[i] ≤104\leq 10^4

Problem
Submissions

Problem: Maximum Performance of a Team

Statement

You are given two integers, n and k, and two integer arrays, speed and efficiency, both of length n. There are n engineers numbered from 1 to n. The value speed[i] represents the speed of the i-th engineer, and efficiency[i] represents their efficiency.

To form a team with the maximum performance, you need to select at most k different engineers from the n engineers.

The performance of a team is calculated as follows:

The sum of the selected engineers’ speeds ×\times the minimum efficiency among the selected engineers

Return the maximum performance of the team. As the result can be a very large number, return it modulo (109+7)(10^9 + 7).

Constraints:

  • 1≤1 \leq k ≤\leq n ≤103\leq 10^3

  • speed.length ==== n

  • efficiency.length ==== n

  • 1≤1 \leq speed[i] ≤103\leq 10^3

  • 1≤1 \leq efficiency[i] ≤104\leq 10^4