aoc-2019-c

Advent of Code 2019 Solutions in C
git clone https://git.sinitax.com/sinitax/aoc-2019-c
Log | Files | Refs | README | sfeed.txt

part2 (1291B)


      1--- Part Two ---
      2
      3You quickly repair the oxygen system; oxygen gradually fills the area.
      4
      5Oxygen starts in the location containing the repaired oxygen system. It takes one minute for oxygen
      6to spread to all open locations that are adjacent to a location that already contains oxygen.
      7Diagonal locations are not adjacent.
      8
      9In the example above, suppose you've used the droid to explore the area fully and have the following
     10map (where locations that currently contain oxygen are marked O):
     11
     12 ##   
     13#..## 
     14#.#..#
     15#.O.# 
     16 ###  
     17
     18Initially, the only location which contains oxygen is the location of the repaired oxygen system. 
     19However, after one minute, the oxygen spreads to all open (.) locations that are adjacent to a
     20location containing oxygen:
     21
     22 ##   
     23#..## 
     24#.#..#
     25#OOO# 
     26 ###  
     27
     28After a total of two minutes, the map looks like this:
     29
     30 ##   
     31#..## 
     32#O#O.#
     33#OOO# 
     34 ###  
     35
     36After a total of three minutes:
     37
     38 ##   
     39#O.## 
     40#O#OO#
     41#OOO# 
     42 ###  
     43
     44And finally, the whole region is full of oxygen after a total of four minutes:
     45
     46 ##   
     47#OO## 
     48#O#OO#
     49#OOO# 
     50 ###  
     51
     52So, in this example, all locations contain oxygen after 4 minutes.
     53
     54Use the repair droid to get a complete map of the area. How many minutes will it take to fill with
     55oxygen?
     56
     57