Editorial for IOI '96 P2 - Job Processing
Submitting an official solution before solving the problem yourself is a bannable offence.
Subtask A
It is obvious that an optimal schedule can be modified in such a way that each machine starts processing at time and never idle until performing the operation on all jobs that are scheduled for that machine.
The maximal number of jobs that can be processed within time by machine
of type
is
. Therefore the minimal amount of time that is needed to perform operation
on all
jobs is the least number
such that:
The following algorithm computes the total processing time for operation in variable
:
t:=0;
Repeat
Inc(t);
Processed:=0;
For i:=1 To M[Op] Do
Processed:=Processed+(t Div PTime[Op,i]);
Until Processed>=N;
Subtask B
It is obvious that the schedule for type A
machines is the same as in the case of subtask A.
Let be the minimal amount of time that is necessary to perform both operations on all
jobs.
We may assume that each machine of type B
finishes processing exactly at time and never idle between executing two consecutive jobs. If this is not the case originally then we can modify the optimal schedule accordingly, since if a job is available at a time in the intermediate container then this job will be available later too.
Let be the time when processing of the first job by a machine of type
B
starts according to the optimal schedule. Denote by the minimal amount of time that is necessary to perform single operation
B
on all jobs. By the same argument as in case of subtask A, we have that
. We already have an algorithm to compute the value
, hence it remains to develop an algorithm which computes the delay time
.
Let be the number of jobs that are finished at time
according to an optimal schedule for a single operation
.
The delay time is the least number that satisfies the following condition:
For every
![]()
, at least
number of jobs are available in the intermediate container at time
.
We can check for a given whether it satisfies the above condition. Therefore the value
could be computed by starting at
and incrementing
while the condition does not hold.
We have faster computation by using incremental method. This method works as follows. The starting value for is
. Suppose that the above condition holds for a given
and
values
. If the condition does not hold for
value
then increase
until the condition holds.
Comments