A citizen-astronomy network logs every stargazing session run on its shared telescopes. Each logged session has a duration measured in seconds, and every session must be filed into exactly one of four fixed duration bands based purely on how long it ran:
0-5: under 5 minutes (duration < 300 seconds)5-10: at least 5 but under 10 minutes (300 <= duration < 600 seconds)10-15: at least 10 but under 15 minutes (600 <= duration < 900 seconds)15+: 15 minutes or more (duration >= 900 seconds)Given the full list of logged sessions, report how many sessions fall into each band. Every band must be reported even when no session falls into it (its count is then 0).
The first line contains a single integer m, the number of logged sessions. Each of the next m lines contains two integers, session_id and duration_seconds, describing one session. session_id values are pairwise distinct and play no role in the answer beyond identifying the row.
Print exactly four lines, one per band, in this fixed order: 0-5, 5-10, 10-15, 15+. Each line contains the band's label, a single space, and the number of sessions in that band.
Example 1
Input
5 101 200 102 420 103 700 104 950 105 150
Expected
0-5 2 5-10 1 10-15 1 15+ 1
Explanation
The durations are 200, 420, 700, 950, and 150 seconds. 200s and 150s are under 300s, landing in band "0-5" (2 sessions). 420s satisfies 300<=d<600, landing in "5-10" (1). 700s satisfies 600<=d<900, landing in "10-15" (1). 950s is >=900, landing in "15+" (1).
Example 2
Input
6 1 299 2 300 3 599 4 600 5 899 6 900
Expected
0-5 1 5-10 2 10-15 2 15+ 1
Explanation
This example exercises every boundary. 299s (<300) falls in "0-5". Both 300s and 599s satisfy 300<=d<600, so "5-10" gets 2 sessions. Both 600s and 899s satisfy 600<=d<900, so "10-15" gets 2 sessions. 900s is >=900, so "15+" gets 1. Note that each exact boundary value (300, 600, 900) belongs to the band ABOVE it, not the one below.
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 →