n kinds of gigs: gig i requires a level of at least levels[i] and pays pay[i]. There are m workers, and worker j has skill skills[j], so they can handle any gig whose level does not exceed their skill.
Each worker takes at most one gig, while the same gig can be done by any number of workers, each getting the full pay. A worker with no suitable gig earns 0.
Return the largest possible total earnings of all workers.levels=[3, 1, 5], pay=[30, 12, 25], skills=[2, 4, 6] → 72
The worker with skill 2 takes the level-1 gig (12), the one with skill 4 takes the level-3 gig (30), and the one with skill 6 also prefers level 3 (30) over level 5 (25). Total 12 + 30 + 30 = 72.
levels=[10, 20], pay=[5, 9], skills=[3, 8] → 0
No worker reaches even level 10, so nobody earns anything.
levels=[2], pay=[7], skills=[2, 2, 9] → 21
levels=[3, 1, 5], pay=[30, 12, 25], skills=[2, 4, 6]
72
Run checks the first 3 tests in your browser. Submit checks all 108 tests on the server, hidden ones included.