130 - Roman Roulette

This problem ask you to simulate Roman Roulette.

At first I simulated Roman Roulette by actually inserting/deleting elements of a cyclic queue. This turned out to be a bad idea: It made my code complicated due to C++ standard container’s iterator invalidation rules. I decided to solve this by marking dead people with -1. With hindsight, I probably should write my cyclic queue that does not invalidate iterators.

Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.