822 - Queue and A

The customer support group of Contest.comreceives and responds to requests for technical support via e-mail. Requestsmay begin arriving when the office opens at 8:00 a.m. and all requests must beserviced by the end of the day.

As requests are received, they areclassified according to a predetermined list of topics. Each member of thesupport staff has responsibility for one or more of these topics and each topichas one or more support personnel assigned to it. Because staff members havedifferent levels of expertise, each staff member has a prioritized list oftopics that he or she can handle. Staff personnel are not permitted to handlerequests outside their specified areas.

As staff members become available, theyselect from the pool of waiting requests according to their priority list oftopics. All requests arriving at time t are available for allocation at time t.If two staff members are simultaneously available, scheduling preference isgiven to the one whose most recent job was scheduled earliest. If there isstill a tie, scheduling preference is given to the person whose id numberappears earlier in the input list of staff people. At the opening of business,all personnel are available to handle requests.

You have been asked to perform a preliminaryanalysis of the technical support environment based on a number of differentscenarios. For each scenario, information will be given about the mix ofrequests and the division of labor among the staff. For each topic, you willgiven the average number of requests per day for that topic, the averageelapsed time before the first of these requests is received, the average timebetween requests for this topic, and the average time needed to service therequest. All times are given in minutes. You will also be given a list ofsupport personnel and, for each one, a list of the topics for which he or shehas responsibility. (Since data are based on estimates, factors such as coffeebreaks, lunch, computer failures, etc., can be ignored.)

Input 

Input consists of a number of scenarios.Each scenario begins with the number of request topics, a positive integer nolarger than 20. This is followed by a description of each topic. Eachdescription consists of five integer values: a unique topic identifier, the numberof requests for that topic, the elapsed time before the first request for thattopic is received, the time needed to service a request, and the time betweensuccessive requests. All but the third of these values are positive integers;the elapsed time until the first request could be zero. Following this, thenumber of personnel is given. This will be a positive integer not to exceed 5.Finally, a description of each person is given in the form of three or morepositive integer values: a unique identifying number for the person, the numberof topics covered by this person, and a list of the topic identifiers arrangedfrom highest priority to lowest priority for that person. A zero follows thelast scenario.

Output 

For each scenario, the output consists ofthe scenario number followed by the statement, "All requests are servicedwithin m minutes.", where m is the number of minutes from the start of thebusiness day until the last request is serviced.

 

Sample Input

Output for the Sample Input

3
128 20 0 5 10
134 25 5 6 7
153 30 10 4 5
4
10 2 128 134
11 1 134
12 2 128 153
13 1 153
0

Scenario 1: All requests are serviced within 195 minutes.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值