Ctrl K

Staffing Plans for a Studio

Hard
A studio has staff employees. There is a list of projects it could take on: project i needs needs[i] employees and brings in revenue[i]. Each employee can work on at most one project. Call a plan any set of projects (possibly empty) that the studio can staff, using at most staff people in total, and whose combined revenue is at least min_revenue. Return the number of distinct plans. The answer can be very large, so return it modulo 10⁹ + 7.
Example 1
staff=4, min_revenue=5, needs=[1, 3, 2], revenue=[2, 4, 3] → 2

The sets {0, 1} (4 people, revenue 6) and {0, 2} (3 people, revenue 5) work. The set {1, 2} needs 5 people and {0, 1, 2} needs 6.

Example 2
staff=3, min_revenue=0, needs=[2, 2], revenue=[0, 7] → 3

The threshold is zero, so the empty plan counts too. Valid plans: empty, {0} and {1}; both projects together need 4 people.

Example 3
staff=10, min_revenue=1, needs=[5, 5, 5], revenue=[1, 1, 1] → 6
Constraints
  • 1 ≤ staff ≤ 100
  • 0 ≤ min_revenue ≤ 100
  • 1 ≤ len(needs) ≤ 100
  • len(revenue) == len(needs)
  • 1 ≤ needs[i] ≤ 100
  • 0 ≤ revenue[i] ≤ 100
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsWater Between Walls HardBiggest Solid Panel Block HardProfit From Two Trades HardEvery Way to Space the Words HardCrossing the Cave Hard
loading Python…
Input
staff=4, min_revenue=5, needs=[1, 3, 2], revenue=[2, 4, 3]
Expected
2

Run checks the first 3 tests in your browser. Submit checks all 116 tests on the server, hidden ones included.