问个谷歌onsite难题

Given a 2D grid with bombs placed at various coordinates and diffusers placed at another set of coordinates. Multiple bombs could exist at the same coodinate in the 2D space but diffusers would be unique per coordinate. The number of diffusers could be less than the number of bombs in which case some bombs might be left unassigned to difuse. Every bomb has a certain ttl to difuse, and each diffuser has a certain capability to difuse a bomb in x amounts of time. Find an assignment such that maximum bombs could be difused in the fastest way. It could be the case that a diffuser assigned to a bomb difuses it and can select another bomb to difuse it within its ttl and capability.

Example:

Input: bombs : [[1, 0, 2], [1, 1, 1], [2, 1, 3]], diffusers: [[2, 0, 3] , [1, -1, 1]]
Output: [[0: [0, 1]], [1: [2]]
Explanation:
Bombs are present at coordinates (1, 0) with a ttl of 2 seconds, (1, 1) with ttl of 1 second, (2, 1) with ttl of 3 seconds.
Diffusers are present at (2, 0) with diffusing capability of 3 seconds and at (1, -1) with diffusing capability of 1 second.
Since ttl of bomb (2, 1) is 3 seconds, we can assign any of the diffusers to diffuse it but we want to difuse max number of bombs
in fastest possible fashion. Hence you would want to assign diffuser at (1, -1) to bomb at (1, 0) and then at (1, 1). While the diffuser
at (2, 0) gets assigned to bomb at (2, 1). Total time taken in this situation to difuse would be 1 + 1 + 3 = 5 seconds.
Related problems: