File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 3030
3131@dataclass (frozen = True )
3232class Database :
33- id_ranges : set [RangeInclusive ]
33+ id_ranges : list [RangeInclusive ]
3434 available_ids : list [int ]
3535
3636 @classmethod
@@ -41,7 +41,7 @@ def from_input(cls, input_data: InputData) -> Self:
4141 lo , hi = map (int , line .split ("-" ))
4242 ranges .add (RangeInclusive .between (lo , hi ))
4343 pids = [int (line ) for line in blocks [1 ]]
44- return cls (ranges , pids )
44+ return cls (RangeInclusive . merge ( ranges ) , pids )
4545
4646
4747Input = Database
@@ -60,7 +60,7 @@ def part_1(self, database: Input) -> Output1:
6060 )
6161
6262 def part_2 (self , database : Input ) -> Output2 :
63- return sum (rng .len for rng in RangeInclusive . merge ( database .id_ranges ) )
63+ return sum (rng .len for rng in database .id_ranges )
6464
6565 @aoc_samples (
6666 (
You can’t perform that action at this time.
0 commit comments