1014 Waiting in Line
Statement
Metadata
- 作者: CHEN, Yue
- 单位: 浙江大学
- 代码长度限制: 16 KB
- 时间限制: 400 ms
- 内存限制: 64 MB
Suppose a bank has
- The space inside the yellow line in front of each window is enough to contain a line with
customers. Hence when all the lines are full, all the customers after (and including) the st one will have to wait in a line behind the yellow line. - Each customer will choose the shortest line to wait in when crossing the yellow line. If there are two or more lines with the same length, the customer will always choose the window with the smallest number.
will take minutes to have his/her transaction processed. - The first
customers are assumed to be served at 8:00am.
Now given the processing time of each customer, you are supposed to tell the exact time at which a customer has his/her business done.
For example, suppose that a bank has 2 windows and each window may have 2 customers waiting inside the yellow line. There are 5 customers waiting with transactions taking 1, 2, 6, 4 and 3 minutes, respectively. At 08:00 in the morning,
At 08:01,
Input Specification
Each input file contains one test case. Each case starts with a line containing 4 positive integers:
The next line contains
The last line contains
Output Specification
For each of the HH:MM
where HH
is in [08, 17] and MM
is in [00, 59]. Note that since the bank is closed everyday after 17:00, for those customers who cannot be served before 17:00, you must output Sorry
instead.
Sample Input
Sample Output
鸣谢用户 不到76kg不改名 和 徐向荣 补充数据!