corrected day 21
This commit is contained in:
parent
a987bcae29
commit
cfd1c55632
|
@ -168,7 +168,7 @@ pub fn run(input: &str) -> i64 {
|
||||||
for seq in seq {
|
for seq in seq {
|
||||||
let seq_num = seq.read_num();
|
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;
|
answer += seq_num as i64 * shortest;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn part2(b: &mut test::Bencher) {
|
fn part1(b: &mut test::Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let v = run(INPUTS[1]);
|
let v = run(INPUTS[1]);
|
||||||
test::black_box(v);
|
test::black_box(v);
|
||||||
|
|
|
@ -168,7 +168,7 @@ pub fn run(input: &str) -> i64 {
|
||||||
for seq in seq {
|
for seq in seq {
|
||||||
let seq_num = seq.read_num();
|
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;
|
answer += seq_num as i64 * shortest;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user