Skip to main content

Module day04

Module day04 

Source
Expand description

§Printing Department

To speed things up, we build a queue of rolls to be removed. For part one, the length of the initial list is the answer. For part two, as we process rolls from the list one at a time, we update neighboring rolls. If any neighbor drops below the threshold, then we add it to the list. This approach avoids a time-consuming scan of the entire grid to find new rolls to remove.

Building the initial list of counts, then processing the list is written to minimize branches. This allows the compiler to auto-vectorize the loops, resulting in a 3.5x speedup.

Functions§

parse
part1
part2

Type Aliases§

Input 🔒