TopCoder problem "ProgramSchedule" used in SRM 231 (Division II Level Three)

Problem Statement

    So much to do and so little time to do it in! You have a long list of computer programs that must be run and you want them to finish running as soon as possible. Each program in the list requires a certain amount of your time to set up, and during this time you must devote your full attention to the setup of that program. After you have finished with the setup of a program, it will immediately start execution and will run for a certain amount of time on the computer. You have enough processing power that all of the programs may be run simultaneously without any of them slowing down. You are to find a schedule such that the time at which all of the programs are finished is as early as possible and you should return that time (assuming you start at time 0).

You will be given int[]'s A and B, corresponding elements of which represent a single program. Each element of A represents the setup time of a program and the corresponding element of B represents the running time of that program.


Parameters:int[], int[]
Method signature:int schedule(int[] A, int[] B)
(be sure your method is public)


-A and B will contain the same number of elements.
-A and B will contain between 1 and 50 elements, inclusive.
-Each element of A and B will be between 1 and 1000, inclusive.


Returns: 12
In this case, you can simply execute the programs in the same order they are given (though there are other ways which give the same final time). The 4 programs will finish after 3, 5, 10, and 12, respectively.
Returns: 11
Returns: 2000

Problem url:

Problem stats url:




PabloGilberto , lbackstrom , brett1479

Problem categories:

Greedy, Sorting