Skip to content

Commit cb4f58f

Browse files
committed
Even further optimize 2024 day 20
1 parent ba81e89 commit cb4f58f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/year2024/src/day20.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ impl Day20 {
9393
let this_distance = self.distances[index];
9494
let target_distance = self.distances[target];
9595
cheats += u16::from(
96-
(target_distance != u16::MAX)
97-
& (target_distance
98-
.saturating_sub(this_distance)
99-
.saturating_sub(cheat_length)
100-
>= 100),
96+
target_distance
97+
.wrapping_add(1)
98+
.saturating_sub(this_distance)
99+
.saturating_sub(cheat_length)
100+
>= 101,
101101
);
102102
}
103103
cheats as u32

0 commit comments

Comments
 (0)