Module aoc::year2018::day23

source ·
Expand description

§Experimental Emergency Teleportation

Part two implements a 3D version of binary search. Starting with a single cube that encloses all nanbots, each cube is further split into 8 smaller cubes until we find the answer. Cubes are stored in a MinHeap ordered by:

  • Greatest number of nanobots in range.
  • Least distance to origin.
  • Least size.

This means that when we encounter a cube of size 1 we can return the coordinates, since we know that:

  • There are no cubes within range of more nanobots.
  • There are no cubes that are closer.
  • The coordinates cannot be refined any further.

Structs§

Functions§