Grouped Bars With hue
Tidewater Foods reports revenue by quarter and by region at once: each quarter gets a cluster of bars, one per region, so regions can be compared inside a quarter and quarters compared across the chart. The commentary always leads on the current quarter, so the tool prints the strongest region within Q1 alone.
Task: Print the strongest region within quarter Q1.
Input
The first line holds one integer n, the number of records. Each of the next n lines holds a quarter label, a region name and one revenue figure, separated by single spaces. Labels and names contain no spaces, and a region may appear on several lines within the same quarter.
Output
One line holding a single region name, exactly as it was read. Consider only the records whose quarter label is Q1; every other quarter is ignored entirely. Within Q1, a region's figure is the average of its own revenue records, not their total.
Example:
Input:
4
Q1 East 100
Q1 West 150
Q2 East 200
Q1 East 50
Output:
West
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