Multimachine Scheduling of Equal-Length Jobs to Minimize the total weighted Flow Time,
or P|rj;pj=p;Dj|Σ wjCj

We are given n jobs. Each job has a priority weight, a release time before which it is not available, a strict deadline by which it has to complete, and each job has the same processing time p. We wish to find a feasible non-preemptive schedule on m processors, which minimizes the weighted sum over the completion times.

This problem was solved by Brucker and Kravchenko (2005), by a linear program, that always has an integer optimum.

Input

Processing time
Number of machines
Release times/weights/deadlines for every job
output the schedule with one job per row and one color per machine
(otherwise one machine per row and one color per job)
zoom x2

Output