Module aoc::year2023::day19

source ·
Expand description

§Aplenty

Each rule is converted into a half open interval, including the start but excluding the end. For example:

  • x > 10 => 10..4001
  • m < 20 => 1..20
  • A => 1..4001

For part one if a category is contained in a range, we send the part to the next rule, stopping when A or R is reached.

For part two we perform range splitting similar to Day 5 that converts the category into 1, 2 or 3 new ranges, then sends those ranges to the respective rule.

Structs§

Functions§

  • Parse each rule from the first half of the input. Leaves the second half of the input as a &str as it’s faster to iterate over each chunk of four numbers than to first collect into a vec.