Skip to content

Commit

Permalink
day20
Browse files Browse the repository at this point in the history
  • Loading branch information
vslinko committed Dec 20, 2024
1 parent 0f07614 commit 1ede0e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/day20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ unsafe fn calc_distances(grid: &[u8], pos: usize, dist: usize, distances: &mut [
}

fn distance(x1: usize, y1: usize, x2: usize, y2: usize) -> usize {
(x1.max(x2) - x1.min(x2)) + (y1.max(y2) - y1.min(y2))
(x1 as isize - x2 as isize).abs() as usize + (y1 as isize - y2 as isize).abs() as usize
}

unsafe fn solve(input: &str, max_cheating_time: usize) -> usize {
Expand Down

0 comments on commit 1ede0e5

Please sign in to comment.