From 68e14d9ef619ca175548f4e94b6a36cba15c5558 Mon Sep 17 00:00:00 2001 From: Rh4096 Date: Tue, 10 Dec 2024 14:05:39 +0700 Subject: [PATCH] optimization --- src/solutions/day_10.rs | 6 +++--- src/solutions/mod.rs | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/solutions/day_10.rs b/src/solutions/day_10.rs index 9fa47a1..73cda72 100644 --- a/src/solutions/day_10.rs +++ b/src/solutions/day_10.rs @@ -10,7 +10,7 @@ use crate::utils::{coord::Coord as Crd, Result}; type Coord = Crd; struct HikingMap { - pub starting_points: HashSet, + pub starting_points: Vec, pub mountain: HashMap, } @@ -35,10 +35,10 @@ impl HikingMap { }) }) .fold( - (HashSet::new(), HashMap::new()), + (Vec::new(), HashMap::new()), |(mut spos, mut map), (coord, heigh)| { if heigh == 0 { - spos.insert(coord); + spos.push(coord); } map.insert(coord, heigh); diff --git a/src/solutions/mod.rs b/src/solutions/mod.rs index b97d678..daa2f4f 100644 --- a/src/solutions/mod.rs +++ b/src/solutions/mod.rs @@ -9,8 +9,23 @@ macro_rules! define_solution { } define_solution!( - day_1, day_2, day_3, day_4, day_5, day_6, day_7, day_8, day_9, day_10, day_11, day_12, day_13, - day_14, day_15, day_16, day_17, day_18, day_19, day_20, day_21, day_22, day_23, day_24, day_25, + day_1, day_2, day_3, day_4, day_5, day_6, day_7, day_8, day_9, + day_10, + // day_11, + // day_12, + // day_13, + // day_14, + // day_15, + // day_16, + // day_17, + // day_18, + // day_19, + // day_20, + // day_21, + // day_22, + // day_23, + // day_24, + // day_25, ); pub trait AocSolution {