Tap here to switch tabs
Problem
Submissions

Problem: Most Profit Assigning Work

med
30 min
Try to solve the Most Profit Assigning Work problem.

Statement

You are given n jobs and m workers, represented by three arrays: difficulty, profit, and worker.

  • difficulty[i] and profit[i] represent the difficulty level and profit of the i-th job.

  • worker[j] represents the maximum difficulty level the j-th worker can handle.

A worker can complete a job only if the job’s difficulty is less than or equal to that worker’s ability. Each worker can be assigned at most one job, but multiple workers can complete the same job.

If a worker cannot complete any job, they contribute 00 profit.

Return the maximum total profit achievable by assigning jobs to workers optimally.

Constraints:

  • n == difficulty.length

  • n == profit.length

  • m == worker.length

  • 1≤1 \leq n, m ≤104\leq 10^4

  • 1≤1 \leq difficulty[i], profit[i], worker[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Most Profit Assigning Work

med
30 min
Try to solve the Most Profit Assigning Work problem.

Statement

You are given n jobs and m workers, represented by three arrays: difficulty, profit, and worker.

  • difficulty[i] and profit[i] represent the difficulty level and profit of the i-th job.

  • worker[j] represents the maximum difficulty level the j-th worker can handle.

A worker can complete a job only if the job’s difficulty is less than or equal to that worker’s ability. Each worker can be assigned at most one job, but multiple workers can complete the same job.

If a worker cannot complete any job, they contribute 00 profit.

Return the maximum total profit achievable by assigning jobs to workers optimally.

Constraints:

  • n == difficulty.length

  • n == profit.length

  • m == worker.length

  • 1≤1 \leq n, m ≤104\leq 10^4

  • 1≤1 \leq difficulty[i], profit[i], worker[i] ≤105\leq 10^5