The Goo Room!  - 3 Points

Boom!....Did you hear that?...Oh no! An alien just exploded outside!

We've only got a short time to get the alien goo off of the passersby. If it contacts skin for more than 24 hrs, they become...GULP...zombies!

Ok...we've got no time, we need to move. Here's the deal...your job will be to schedule a simulation program that will allow us to get these people in and out, and we need to be organized! Your program will plan the usage of rinsing and drying rooms during the course of the cleanup effort.

We've got several rinsing and drying rooms. Each client is assigned to an available rinsing room and following his/her rinse they are assigned to one of the drying rooms, where they are monitored and evaluated. The clients are officially scheduled for rinsing immediately, but the order in which they actually go into the rinse rooms depends on the order of the roster. A client beginning their cleaning goes into the lowest numbered operating room available. For example, if rooms 2 and 4 become available simultaneously, the next client on the roster not yet in cleaning goes into room 2 and the next goes into room 4 at the same time. After rinsing, a patient is taken to the available drying room with the lowest number. If two clients emerge from their rinse at the same time, the client with the lower number will be the first assigned to a drying room. (If in addition the two patients entered rinsing at the same time, the one first on the roster is first assigned a bed.)

Note: The amount of time necessary to transport a client from an rinse room to a drying room is fixed and independent of the patient. Similarly, both the amount of time to prepare a rinse room for the next patient and the amount of time to prepare a drying room bed for a new patient are fixed.

Input Format
The input file will contain only todays simulation data.
All numeric data in the input file are integers, and successive integers on the same line are separated by blanks.

The first line of the file is the set of hospital configuration parameters to be used for this run. The parameters are, in order:
# of rinsing rooms (maximum of 10)
# of drying room beds (maximum of 30)
Time that we can begin taking clients (based on a 24-hour clock)
Minutes to transport patient from rinse room to drying room
Minutes to prepare rinse room for next patient
Minutes to prepare drying room bed for next patient
Number of clients (maximum of 100)

This initial configuration data will be followed by pairs of lines of client data as follows:

Line 1: Last name of patient (maximum of 8 characters)
Line 2: <Minutes required for rinsing> <Minutes required for drying/observation>

Records in the input file are ordered according to the roster, which determines the order in which clients are scheduled for their rinse. The number of drying rooms specified in any configuration will be sufficient to handle clients arriving from rinsing (No queueing of clients for drying room beds will be required). Computed times will not extend past 24:00.

The input file will be called jin13.txt.

Output Format
Correct output shows which rinsing room and which drying room is used by each client, and the time period that the client uses the two rooms along with a summary of the utilization of our facilities for that day. The output file consists of a table describing the results of the simulation run. The table is in columnar form with appropriate column labels to show the number of each client (in the order the roster), the clients last name, the rinse room number, the time rinsing begins and ends, the drying room number and the time the client enters gd leaves the drying room.

Example
Input
2 5 1000 5 5 5 4
Billings
50 15
Commons
48 200
Mills
57 100
Albers
10 100


Output
Patient   Rinsing Room            Drying Room
#  Name   Room#   Begin     End   Bed#   Begin    End
Billings   1   10:00    10:50   2     10:55    11:10
2  
Commons    2   10:00    10:48   1     10:53    14:13
3  
Mills      2   10:53    11:50   3     11:55    13:35
4  
Albers     1   10:55    11:05   2     11:10    12:50