Search for a command to run...
You are given A days in a year, numbered from 1 to A.
You must complete M different types of work, each with its own deadline and required duration.
You are given a 2D array B of size M Γ 3, where each row represents a work type:
B[i][0] β The day on which the work is assignedB[i][1] β The deadline day (the work must be completed before this day)B[i][2] β The number of days required to complete this work> Work types are numbered from 1 to M.
On any given day, only one of the following actions can be performed:
B[i][1]) for any work, no work can be done on this day.Determine whether it is possible to complete all M work types within the given constraints.
result[0] = 1d (1 β€ d β€ A):0 β Rest dayM + 1 β Deadline dayx (1 β€ x β€ M) β Work of type x is performed on day dExample 1
[5, [[1,4,2],[2,5,2]]][1, 1, 2, 0, 3, 0][5, [[1,4,2],[2,5,2]]]
[1, 1, 2, 0, 3, 0]