From ddfc5ff15403b4a34813d9cc6a0799c2ddbc3a65 Mon Sep 17 00:00:00 2001 From: Viacheslav Slinko Date: Wed, 18 Dec 2024 20:31:06 +0300 Subject: [PATCH] day18 --- src/day18.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/day18.rs b/src/day18.rs index 699d4db..5dd801d 100644 --- a/src/day18.rs +++ b/src/day18.rs @@ -1,6 +1,5 @@ use dary_heap::BinaryHeap; use std::cmp::Ordering; -use std::fmt::Display; const WIDTH: usize = 71; const HEIGHT: usize = 71; @@ -129,11 +128,11 @@ unsafe fn find_fastest_path_score(grid: &[bool; GRID_SIZE]) -> usize { usize::MAX } -pub fn part1(input: &str) -> impl Display { +pub fn part1(input: &str) -> usize { unsafe { inner1(input) } } -unsafe fn inner1(input: &str) -> impl Display { +unsafe fn inner1(input: &str) -> usize { let input = input.as_bytes(); let mut grid = [true; GRID_SIZE]; let mut i = 0; @@ -163,11 +162,11 @@ unsafe fn inner1(input: &str) -> impl Display { find_fastest_path_score(&grid) } -pub fn part2(input: &str) -> impl Display { +pub fn part2(input: &str) -> String { unsafe { inner2(input) } } -unsafe fn inner2(input: &str) -> impl Display { +unsafe fn inner2(input: &str) -> String { let input = input.as_bytes(); let mut initial_grid = [true; GRID_SIZE]; let mut i = 0;