From 679dd4ebab1c501dd847889648432aad9a6777bd Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 15 Dec 2023 09:21:31 -0600 Subject: [PATCH] day 12 part 2 fixed D'oh. 1<<0 is a power of 2. Timing: ~130ms GNU, ~190ms POSIX. Parsing dominates. The search for palindromes is worst-case O(n^2) (starting n comparison cycles that each visit up to n/2 rows), but in practice it is closer to linear (most comparisons short-circuit when they fail on the first try). --- 2023/day13.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2023/day13.m4 b/2023/day13.m4 index 7eb4583..535f042 100644 --- a/2023/day13.m4 +++ b/2023/day13.m4 @@ -24,7 +24,7 @@ ifdef(`__gnu__', ` define(`part1', 0)define(`part2', 0) define(`bump', `define(`$1', eval($1+$2))') -forloop(1, 20, `define(`a'eval(1<<', `))') +forloop(0, 20, `define(`a'eval(1<<', `))') # try(seen, lo, hi, name, bound, amt) define(`_try', `ifelse($1$2, 0, `bump(`part1', $6)', $1$3, $5, `bump(`part1', -- 2.11.4.GIT