From 4d2cc20f0e77f9be10eb6d3773da7e5c6f70f871 Mon Sep 17 00:00:00 2001 From: kageru Date: Tue, 8 Dec 2020 15:03:09 +0100 Subject: [PATCH] Make day 08 ready for big boi input 20MB input still runs in 0.7ms :umu: --- 2020/src/bin/day08.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2020/src/bin/day08.rs b/2020/src/bin/day08.rs index 51ab5d8..d3e6815 100644 --- a/2020/src/bin/day08.rs +++ b/2020/src/bin/day08.rs @@ -61,7 +61,7 @@ fn part2(commands: &Vec, seen: &mut Vec, mut index: i32, mut acc: seen[index as usize] = true; match commands[index as usize] { Command::NOP(x) => { - if !changed { + if !changed && index > -x { if let Some(n) = part2(commands, seen, index + x, acc, true) { return Some(n); }