Skip to content

securedoors

bradendubois edited this page Oct 7, 2021 · 7 revisions

Secure Doors

ID: securedoors

Difficulty: 1.7

CPU Time: 1 second

Memory: 1024 MB

Solution

For this, one can simply keep a map of people to whether or not they are in the building (initially no one is inside). On each line, output the person's name, the action they did ("entered" or "exited"), and then check whether the person was already inside for an entry or already outside for an exiting, outputting "(ANOMALY)" in those cases, and then updating the person's location either way.

Clone this wiki locally