212 - Use of Hospital Facilities

来源:互联网 发布:微信小程序 源码下载 编辑:程序博客网 时间:2024/04/30 09:33

County General Hospital is trying to chartits course through the troubled waters of the economy and shifting populationdemographics. To support the planning requirements of the hospital, you havebeen asked to develop a simulation program that will allow the hospital toevaluate alternative configurations of operating rooms, recovery rooms andoperations guidelines. Your program will monitor the usage of operating roomsand recovery room beds during the course of one day.

County General Hospital has severaloperating rooms and recovery room beds. Each surgery patient is assigned to anavailable operating room and following surgery the patient is assigned to oneof the recovery room beds. The amount of time necessary to transport a patientfrom an operating room to a recovery room is fixed and independent of thepatient. Similarly, both the amount of time to prepare an operating room forthe next patient and the amount of time to prepare a recovery room bed for anew patient are fixed.

All patients are officially scheduled forsurgery at the same time, but the order in which they actually go into theoperating rooms depends on the order of the patient roster. A patient enteringsurgery goes into the lowest numbered operating room available. For example, ifrooms 2 and 4 become available simultaneously, the next patient on the rosternot yet in surgery goes into room 2 and the next after that goes into room 4 atthe same time. After surgery, a patient is taken to the available recovery roombed with the lowest number. A recovery room bed is only available if thepreparation is already finished when the patient leaves surgery. If twopatients emerge from surgery at the same time, the patient with the lowersurgery room number will be the first assigned to a recovery room bed.

Input

The input file contains data for severalsimulation runs. Each run is separated by a blank line. All numeric data in theinput file are integers, and successive integers on the same line are separatedby blanks. The first line of each run is the set of hospital configurationparameters to be used for this run. The parameters are, in order:

 

                      Number of operating rooms  (maximum of 10)

 

                      Number of recovery room beds  (maximum of 30)

 

                      Starting hour for 1st surgery of day (basedon a 24-hour clock)

 

                      Minutes to transport patient from operatingroom to recovery room

 

                      Minutes to prepare operating room for nextpatient

 

                      Minutes to prepare recovery room bed fornext patient

 

                      Number of surgery patients for the day   (maximum of 100)

 

This initial configuration data will befollowed by pairs of lines of patient data as follows:

 

                    Line 1: Last name of patient (maximum of 8 characters)

 

                    Line 2: Minutes required for surgery Minutes required in the recovery room

 

Patient records in the input file areordered according to the patient roster, which determines the order in whichpatients are scheduled for surgery. The number of recovery room beds specifiedin any configuration will be sufficient to handle patients arriving fromsurgery (No queuing of patients for recovery room beds will be required).Computed times will not extend past 24:00.

Output

Correct output shows which operating roomand which recovery room bed is used by each patient, and the time period thatthe patient uses the room and bed along with a summary of the utilization ofhospital facilities for that day. The output file consists of several sets oftwo tables each describing the results of the simulation run. The first tableis in columnar form with appropriate column labels to show the number of eachpatient (in the order the patient roster), the patient's last name, theoperating room number, the time surgery begins and ends, the recovery bednumber and the time the patient enters and leaves the recovery room bed.

The second table will also be in columnarform with appropriate column labels summarizing the utilization of operatingrooms and recovery room beds. This summary indicates the facility type (room orbed), the facility number, the number of minutes used and percentage ofavailable time utilized. Available time is defined as the time in minutes fromthe starting time for 1st surgery of day to the ending time of thelast patient in a recovery room bed. Print a blank line after each run. Followthe output format shown on sample output.

Sampleinput

5 12 07 5 15 10 16

Jones

28 140

Smith

120 200

Thompson

23 75

Albright

19 82

Poucher

133 209

Comer

74 101

Perry

93 188

Page

111 223

Roggio

69 122

Brigham

42 79

Nute

22 71

Young

38 140

Bush

26 121

Cates

120 248

Johnson

86 181

White

92 140

Sampleoutput

 Patient          Operating Room          Recovery Room

 # Name     Room#  Begin  End      Bed#  Begin   End

 ------------------------------------------------------

 1 Jones      1    7:00   7:28      3    7:33   9:53

 2 Smith      2    7:00   9:00      1    9:05  12:25

 3 Thompson   3    7:00   7:23      2    7:28   8:43

 4 Albright   4    7:00   7:19      1    7:24   8:46

 5 Poucher    5    7:00   9:13      5    9:18  12:47

 6 Comer      4    7:34   8:48      4    8:53  10:34

 7 Perry      3    7:38   9:11      2    9:16  12:24

 8 Page       1    7:43   9:34      6    9:39  13:22

 9 Roggio     4    9:03  10:12      9   10:17  12:19

10 Brigham    2    9:15   9:57      8   10:02  11:21

11 Nute       3    9:26   9:48      7    9:53  11:04

12 Young      5    9:28  10:06      3   10:11  12:31

13 Bush       1    9:49  10:15     10   10:20  12:21

14 Cates      3   10:03  12:03      8   12:08  16:16

15 Johnson    2   10:12  11:38      4   11:43  14:44

16 White      5   10:21  11:53      7   11:58  14:18

 

Facility Utilization

Type # Minutes  % Used

-------------------------

Room 1     165   29.68

Room 2     248   44.60

Room 3     258   46.40

Room 4     162   29.14

Room 5     263   47.30

Bed  1     282   50.72

Bed  2     263   47.30

Bed  3     280   50.36

Bed  4     282   50.72

Bed  5     209   37.59

Bed  6     223   40.11

Bed  7     211   37.95

Bed  8     327   58.81

Bed  9     122   21.94

Bed 10     121   21.76

Bed 11       0    0.00

Bed 12       0    0.00

 

ly:宋|mo@����theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>为方便起见,将每一种集合映射成唯一的ID来标志,为每个不同的集合分配一个唯一的ID,那么每个集合都可以表示成包含元素的ID集合。各种容器的功能如下:

set<int> :空集({})中没有任何数字,内含一个空集的集合({ {} })存取成{0},因为0是空集({})的ID,也就是说将存取不同集合的集合转化为存取不同集合对应ID数字的集合,转化后便于操作

map<Set,int> IDcache:使用映射来完成将存取不同集合(键)的集合转化为存取不同集合对应ID数字(值)的集合的功能

vector<Set> Setcache:每一种不同的集合都存取在该数组中,且集合的ID由集合存取在该数组中的先后顺序决定

stack<int> s:栈:存取每个插入的集合的ID

 

0 0