Before Vector Bill was committing crimes with magnitude and direction, he was a humble fry cook at Wendy's, where quality is their recipe. As more of a back-end guy, Bill rarely dealt with customers directly, and for good reason: he was awful at managing orders and could never get the food out to customers in a timely fashion.
One day, however, Bill was stuck being the cashier and was forced to take orders directly from the customers. In order to keep his restaurant running as efficiently as pushing back on a vector, Bill decided to come up with an algorithm to determine what order in which his customers would receive their food.
For instance, suppose there were n
customers. Each unique order i
is
placed by a customer at time ti and the order takes
di units of time to process.
Given all this information about all n
orders, Bill wants to determine
the order in which all n
customers will receive their food.
The input will be a series of test cases where the first number n
is the
number of orders. This is followed by n
pairs of integers corresponding to
ti and di.
3 1 3 2 3 3 3 5 8 1 4 2 5 6 3 1 4 3
For each test case, output the order in which the customers will receive their order. Note, if two customers receive their food at the same time, then output the order numbers in ascending order.
1 2 3 4 2 5 1 3
This is based on the Jim and the Orders problem on HackerRank.
To submit your work, follow the same procedure you used for Reading 00:
$ cd path/to/cse-31072-fa17-assignments # Go to assignments repository $ git checkout master # Make sure we are on master $ git pull --rebase # Pull any changes from GitLab $ git checkout -b challenge10 # Create and checkout challenge10 branch $ $EDITOR challenge10/program.cpp # Edit your code $ git add challenge10/program.cpp # Stage your changes $ git commit -m "challenge10: done" # Commit your changes $ git push -u origin challenge10 # Send changes to GitLab
To check your code, you can use the .scripts/submit.py
script or curl:
$ .scripts/submit.py Submitting challenge10 assignment ... Submitting challenge10 code ... Result Success Score 6.00 $ curl -F source=@challenge10/program.cpp https://dredd.h4x0r.space/code/cse-31072-fa17/challenge10 {"score": 6, "result": "Success"}
Once you have commited your work and pushed it to GitLab, member to create a merge request. Refer to the Reading 05 TA List to determine your corresponding TA for the merge request.