Module aoc::year2017::day20

source ·
Expand description

§Particle Swarm

§Part One

The particle that remains closest to the origin as time goes to infinity has the lowest acceleration, measured via its manhattan value. If more than one particle shares the same lowest acceleration then ties are broken by velocity then by position.

§Part Two

The input is constructed so that all collisions happen within 40 ticks so a simple brute force solution is much faster than more elegant alternatives, for example solving the quadratic equation describing each particle’s position.

Structs§

Functions§