A logistics network operates n warehouse facilities, each identified by a name. Every facility has a floor space (in square meters) and a daily package throughput. A facility counts as a flagship site if it clears either scale bar on its own: a floor space of at least 500000 square meters, or a daily throughput of at least 2000000 packages (clearing just one of the two bars is enough).
List every flagship site, in the same relative order they were given, showing each one's name, throughput, and floor space.
n — the number of facilities.n lines contains a facility's name, floor space, and throughput, separated by spaces: name floorSpace throughput.For every flagship facility, print one line: name throughput floorSpace, separated by single spaces, in the same relative order as the input. If no facility qualifies, print nothing.
name consists of 1 to 20 letters, digits, or underscores (no spaces); names need not be uniqueExample 1
Input
4 Alpha 600000 100 Beta 100 50 Gamma 200000 3000000 Delta 10 10
Expected
Alpha 100 600000 Gamma 3000000 200000
Explanation
Alpha has floor space 600000, which already clears the 500000 bar, so it qualifies regardless of its throughput of 100. Beta clears neither bar (100 < 500000 and 50 < 2000000) and is skipped. Gamma has floor space only 200000 but a throughput of 3000000, clearing the throughput bar, so it also qualifies. Delta clears neither bar. In input order, the output lines are for Alpha (throughput 100, floor space 600000) and Gamma (throughput 3000000, floor space 200000).
Example 2
Input
3 Echo 100 100 Foxtrot 200 200 Golf 300 300
Expected
(empty)Explanation
None of the three facilities reaches either the 500000 floor-space bar or the 2000000 throughput bar, so no facility qualifies and the output is empty.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →