From cfd1c556325430cfba7d64eaecb919101c598a54 Mon Sep 17 00:00:00 2001 From: Ishan Jain Date: Sun, 22 Dec 2024 14:06:10 +0530 Subject: [PATCH] corrected day 21 --- src/day21/1.rs | 4 ++-- src/day21/2.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/day21/1.rs b/src/day21/1.rs index 660adc7..914865b 100644 --- a/src/day21/1.rs +++ b/src/day21/1.rs @@ -168,7 +168,7 @@ pub fn run(input: &str) -> i64 { for seq in seq { let seq_num = seq.read_num(); - let shortest = compute(NAV_KEYPAD, seq, 1 + 25, &mut cache); + let shortest = compute(NAV_KEYPAD, seq, 1 + 2, &mut cache); answer += seq_num as i64 * shortest; } @@ -341,7 +341,7 @@ fn main() { } #[bench] -fn part2(b: &mut test::Bencher) { +fn part1(b: &mut test::Bencher) { b.iter(|| { let v = run(INPUTS[1]); test::black_box(v); diff --git a/src/day21/2.rs b/src/day21/2.rs index d6b2f20..660adc7 100644 --- a/src/day21/2.rs +++ b/src/day21/2.rs @@ -168,7 +168,7 @@ pub fn run(input: &str) -> i64 { for seq in seq { let seq_num = seq.read_num(); - let shortest = compute(NAV_KEYPAD, seq, 1 + 2, &mut cache); + let shortest = compute(NAV_KEYPAD, seq, 1 + 25, &mut cache); answer += seq_num as i64 * shortest; }