Rejigged Solution implementation, 50% speedup

Replaced the map-driven solution with a vector. Uses less peak memory
(every variable is going to need a value at some point anyway, and a
vector is going to use less memory per item than a map), but will use if
or longer.

Probably worth it for the 50% speedup.