ACM Programming Contest solution walkthrough

In preparation for the ACM World Finals coming up in April, we’ve been running through previous years’ problem sets to get a feel for what we’ll be up against. It’s been interesting, for the most part. The problems definitely require more up-front thought before a solution presents itself, compared to the “regular” contest problems. Since a cursory Google search didn’t turn up anything useful for “ACM contest walkthrough,” I thought I’d write up the solution to one of the more interesting problems we’ve covered.

Crowd around, young ones…