A Two-Panel Sales Dashboard
Kestrel Freight's morning dashboard has two panels: parcels handled per day across the week on top, and totals by service type underneath. The screen is read at a glance in a warehouse, so the tool also prints the two answers the panels exist to give — which day carried the most, and which service type is biggest — as plain text for the shift handover sheet.
Task: Print the busiest day's position and the largest service type.
Input
Four parts. The first line holds one integer n, the number of days. The second line holds n daily figures separated by single spaces. The third line holds one integer k, the number of service types. Each of the next k lines holds a service type name and its total, separated by a single space. Names contain no spaces.
Output
Two lines. The first is the position of the largest daily figure, counting from 0, so the first day is position 0. The second is the name of the service type with the largest total. If two days tie, or two service types tie, report whichever came first.
Example:
Input:
3
100 150 120
2
Electronics 500
Clothing 300
Output:
1
Electronics
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in