advent2022

Advent of Code 2022 Solutions
git clone git://bsandro.tech/advent2022
Log | Files | Refs | README | LICENSE

task.txt (2327B)


      1 --- Day 18: Boiling Boulders ---
      2 
      3 You and the elephants finally reach fresh air. You've emerged near the base of a large volcano that seems to be actively erupting! Fortunately, the lava seems to be flowing away from you and toward the ocean.
      4 
      5 Bits of lava are still being ejected toward you, so you're sheltering in the cavern exit a little longer. Outside the cave, you can see the lava landing in a pond and hear it loudly hissing as it solidifies.
      6 
      7 Depending on the specific compounds in the lava and speed at which it cools, it might be forming obsidian! The cooling rate should be based on the surface area of the lava droplets, so you take a quick scan of a droplet as it flies past you (your puzzle input).
      8 
      9 Because of how quickly the lava is moving, the scan isn't very good; its resolution is quite low and, as a result, it approximates the shape of the lava droplet with 1x1x1 cubes on a 3D grid, each given as its x,y,z position.
     10 
     11 To approximate the surface area, count the number of sides of each cube that are not immediately connected to another cube. So, if your scan were only two adjacent cubes like 1,1,1 and 2,1,1, each cube would have a single side covered and five sides exposed, a total surface area of 10 sides.
     12 
     13 Here's a larger example:
     14 
     15 2,2,2
     16 1,2,2
     17 3,2,2
     18 2,1,2
     19 2,3,2
     20 2,2,1
     21 2,2,3
     22 2,2,4
     23 2,2,6
     24 1,2,5
     25 3,2,5
     26 2,1,5
     27 2,3,5
     28 
     29 In the above example, after counting up all the sides that aren't connected to another cube, the total surface area is 64.
     30 
     31 What is the surface area of your scanned lava droplet?
     32 
     33 Your puzzle answer was 3496.
     34 
     35 The first half of this puzzle is complete! It provides one gold star: *
     36 --- Part Two ---
     37 
     38 Something seems off about your calculation. The cooling rate depends on exterior surface area, but your calculation also included the surface area of air pockets trapped in the lava droplet.
     39 
     40 Instead, consider only cube sides that could be reached by the water and steam as the lava droplet tumbles into the pond. The steam will expand to reach as much as possible, completely displacing any air on the outside of the lava droplet but never expanding diagonally.
     41 
     42 In the larger example above, exactly one cube of air is trapped within the lava droplet (at 2,2,5), so the exterior surface area of the lava droplet is 58.
     43 
     44 What is the exterior surface area of your scanned lava droplet?