hangingout - bradendubois/competitive-programming GitHub Wiki

Hanging Out on the Terrace

ID: hangingout

Difficulty: 1.6

CPU Time: 1 second

Memory: 1024 MB

Solution

One would assume the roof to be empty (0) at the start, and so when a group attempts to enter, simply add that amount if there is space (L - group), otherwise increment the total number of denials. When a group leaves, simply decrement the count of people on the roof by that amount.