ECOO 2002 Boardwide Programming Contest
Problem 5: STACK Print Server
In a computer science lab, somewhere in Ontario, print jobs are sent to a print server. It is standard practice, that all jobs are placed in a queue, and they are printed in first-come-first-served order.
However, in this case, print jobs are placed on a stack, where the last one in is the first one out. When a job gets pushed onto the stack at the same time as the server "pops" a job off the stack, popping takes place before pushing.
The input will contain 5 sets of data. The first line of each data set contains the number of lines that follow. Each of these lines contains three data, separated by a space: a 6-digit number representing the time the job is pushed onto the stack of the form: HHMMSS; a 3 digit number, representing the number of seconds it takes to print the job; and the name of the person who is sending the job (no more than 10 characters). The list is in the order in which jobs are requested.
It is your task to output the statistics on the 5th and last person printed.
Sample Input: (3 of 5 cases only: no blank lines between sets)
12 110246 006 Alyssa 110332 189 Juan 110338 124 Jack 110422 074 Tanner 110608 130 Mary 110628 117 Seth 110915 003 Joshua 110947 007 Elizabeth 110957 023 Shelby 111048 133 Dalton 111123 095 Makayla 111205 193 Kayla | 10 111316 065 Dylan 111357 189 David 111411 050 Miguel 111449 048 Cameron 111553 047 Monica 111647 173 Sydney 111813 172 Maria 111832 040 Patrick 111836 032 Melissa 111956 098 Ryan | 13 112030 172 Miranda 112045 062 Katherine 112229 003 Kaylee 112310 086 Alexander 112440 151 Jesse 112810 066 Anthony 112915 023 Stephanie 113109 170 Sierra 113208 115 Gabriel 113254 174 Mark 113352 078 Caroline 113540 171 Brooke 113552 178 Steven |
Sample Output:
job 5 completed at 11:11:11 for Shelby job 12 completed at 11:21:40 for Jack job 5 completed at 11:19:55 for David job 10 completed at 11:28:30 for Sydney job 5 completed at 11:28:24 for Katherine job 13 completed at 11:45:55 for Gabriel
Detailed Analysis for the first list:
11:02:46 Alyssa arrives: busy till: 11:02:52 11:02:52 Alyssa is finished: Job #1 11:03:32 Juan arrives: busy till: 11:06:41 11:03:38 Jack on the stack. Number of people waiting: 1 11:04:22 Tanner on the stack. Number of people waiting: 2 11:06:08 Mary on the stack. Number of people waiting: 3 11:06:28 Seth on the stack. Number of people waiting: 4 11:06:41 Juan is finished: Job #2 11:06:41 Seth from the stack: busy till: 11:08:38 11:08:38 Seth is finished: Job #3 11:08:38 Mary from the stack: busy till: 11:10:48 11:09:15 Joshua on the stack. Number of people waiting: 3 11:09:47 Elizabeth on the stack. Number of people waiting: 4 11:09:57 Shelby on the stack. Number of people waiting: 5 11:10:48 Mary is finished: Job #4 11:10:48 Shelby from the stack: busy till: 11:11:11 11:10:48 Dalton on the stack. Number of people waiting: 5 11:11:11 Shelby is finished: Job #5 11:11:11 Dalton from the stack: busy till: 11:13:24 11:11:23 Makayla on the stack. Number of people waiting: 5 11:12:05 Kayla on the stack. Number of people waiting: 6 11:13:24 Dalton is finished: Job #6 11:13:24 Kayla from the stack: busy till: 11:16:37 11:16:37 Kayla is finished: Job #7 11:16:37 Makayla from the stack: busy till: 11:18:12 11:18:12 Makayla is finished: Job #8 11:18:12 Elizabeth from the stack: busy till: 11:18:19 11:18:19 Elizabeth is finished: Job #9 11:18:19 Joshua from the stack: busy till: 11:18:22 11:18:22 Joshua is finished: Job #10 11:18:22 Tanner from the stack: busy till: 11:19:36 11:19:36 Tanner is finished: Job #11 11:19:36 Jack from the stack: busy till: 11:21:40 11:21:40 Jack is finished: Job #12
All Submissions
Best Solutions
Point Value: 15
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 04, 2009
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
Edit: Is it 24 hour time?
Any help is much appreciated