diff --git a/src/holt59/aoc/2024/day9.py b/src/holt59/aoc/2024/day9.py index 3ab9d39..ea1faaa 100644 --- a/src/holt59/aoc/2024/day9.py +++ b/src/holt59/aoc/2024/day9.py @@ -42,7 +42,7 @@ class Solver(BaseSolver): contents = contents_0.copy() - for block_start, block_length in blocks[::-1]: + for block_start, block_length in self.progress.wrap(blocks[::-1]): try: i_free = next( i_free @@ -54,11 +54,10 @@ class Solver(BaseSolver): free_start, free_length = frees[i_free] - for i in range(block_length): - contents[free_start + i], contents[block_start + i] = ( - contents[block_start + i], - None, - ) + contents[free_start : free_start + block_length] = contents[ + block_start : block_start + block_length + ] + contents[block_start : block_start + block_length] = [None] * block_length if free_length == block_length: del frees[i_free]