-->
当前位置:首页 > 题库

PROGRAMMING:The single window "jam" version of bank queuing problem

Luz5年前 (2021-05-10)题库496
Queuing "jam" is a behavior that causes people's strong dissatisfaction, but this phenomenon often exists. In the bank's single window queuing problem, it is assumed that the bank has only one window to provide service, and all customers are arranged in a long line according to the arrival time. When the window is free, the next customer goes to the window to process the transaction. At this time, if it is known that the $$I $$customer and the $$J $$customer are good friends, and they are willing to handle affairs for their friends, then the transaction processing time of the $$I $$customer is the sum of their own affairs and their friends' offices. In this case, the waiting time of customers may be affected. Suppose that when everyone arrives at the bank, if there is no empty window, they will ask for the help of the top friends (including those who are receiving service in the window); When more than one friend asks for a customer's help, the customer will deal with the transaction in turn according to the order of his friend's request. Try to write a program to simulate this phenomenon, and calculate the average waiting time of customers.
###Input format:
The first line of input is two integers: $$1 / Le n / Le 10000 $$, which is the total number of customers$$ 0 m 100 $$, which is the number of disjoint circles of friends. If $$M $$is not 0, then the following $$M $$lines will be given, each line will first give the positive integer $$2 / Le L / Le 100 $$, representing the total number of friends in the circle, and then give the names of $$l $$friends in the circle. The name consists of three capital letters separated by a space. Finally, the $$n $$line gives the names of $$n $$customers, the arrival time $$t $$and the transaction time $$p $$(in minutes), separated by a space. For simplicity, it is assumed that customer information is given in the order of arrival time (those with parallel time are queued in the order given), and that each transaction takes up 60 minutes of window service at most (if it exceeds 60 minutes).
###Output format:
Output customer name according to the order of customer receiving service, each name occupies 1 line. The last line outputs the average waiting time of all customers to 1 decimal place.
###Input example:
```in
6 2
3 ANN BOB JOE
2 JIM ZOE
JIM 0 20
BOB 0 15
ANN 0 30
AMY 0 2
ZOE 1 61
JOE 3 10
```
###Output example:
```out
JIM
ZOE
BOB
ANN
JOE
AMY
seventy-five point two
```






answer:If there is no answer, please comment