Tap here to switch tabs
Problem
Submissions

Problem: Most Profit Assigning Work

Most Profit Assigning Work gives job difficulties and profits plus worker abilities. Assign each worker at most one job they can handle, allow jobs to be reused, and return the maximum total profit.

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

Most Profit Assigning Work gives job difficulties and profits plus worker abilities. Assign each worker at most one job they can handle, allow jobs to be reused, and return the maximum total profit.

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