Function aoc::year2022::day15::part1_testable
source · pub fn part1_testable(input: &[Input], row: i32) -> i32
Expand description
A beacon cannot be located with the the radius of a sensor unless it is the closest beacon.
We first convert each scanner’s diamond shaped area into a one dimensional range at the specified row. By sorting the ranges, we can quickly calculate the total number of distinct ranges where another beacon cannot exist, only counting overlapping areas once.
Beacons can also not be located at the same position as another beacon so we then also discount any beacon located exactly on the specified row.