One time interval is set within which the processes will be distributed.For example, 100 days.

There are N number of processes that have different durations from 1 to M days.At the same time, more than K processes will be executed.

The task is to distribute all processes as efficiently as possible using a given interval.

We have one performer, and at the same time he can perform no more than K processes.Sequence and intervals do not matter.

By maximum rationality is meant to cram all the existing processes into the initially specified interval, so that more than K processes would be executed at one time.

If this is impossible - then solve the problem as little as possible beyond the scope.That is, when a situation arises that all processes do not fit in a given interval, we can still hang the K + n process on the executor, but it is impossible to go beyond the limits of the initially specified interval.

At the exit, we need to get a sequence of processes.

I can not understand how to solve this problem.Can you tell me the algorithm, or in general in which direction to dig?

2 Answers 2
This is a typical packing problem.

In the"box" with a length of 100 and a width of K, you need to cram a set of sausages with a width of 1 and of different lengths.