tvl-depot/users/sterni/exercises/aoc/2022/20/20.bqn
sterni 68555896de feat(sterni/aoc/2022): day20 BQN solution
This solution feels very un-BQN-esque, but I could not get it to work by
doing arithmetic operations on an array of indices for any input but the
example one. It's still decently fact considering that we create so many
intermediate arrays at each step.

Change-Id: I883409b4d99d4954312df9b9a9ffc568c39f7726
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7602
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-20 19:03:28 +00:00

13 lines
469 B
BQN
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ReadDec •Import "../../lib.bqn"
enc ReadDec¨ •FLines "input"
CoordSum +´(100020003000((|+((/=0)))))
Mix {
M {m 𝕊 i:
l m
i {n (l-1)|(𝕩m)+/𝕩=𝕨 (n(𝕩)n) 𝕩(/)𝕨}˜´ l
}
CoordSum ((M𝕨)) 𝕩
}
•Out "day20.1: "•Fmt 1 Mix enc
•Out "day20.2: "•Fmt 10 Mix 811589153×enc