Skip to content

Commit

Permalink
feat: added day 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
Panadestein committed Dec 11, 2024
1 parent 9debe0d commit 3a89f4b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/aoc24.org
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@ to get more context. These definitions and imports are shared by the various puz
#+RESULTS:
: ⟨ 776 1657 ⟩

** XI

#+begin_src bqn :tangle ./bqn/aoc24.bqn
XI ← {
inp ← •ParseFloat¨' 'Split⊑•Flines Input𝕩 ⋄ m ← •HashMap˜⟨⟩
B ← {
𝕨𝕊𝕩: m.Has𝕨‿𝕩 ? m.Get𝕨‿𝕩;
·𝕊0: 1;
0𝕊𝕩: 𝕩{𝕩 ⊣ 𝕨m.Set𝕩}1𝕊𝕩-1;
e𝕊c: l‿r ← e (⌊∘÷⋈|˜) 10⋆⌊2÷˜d ← ⌊1+10⋆⁼e
{𝕩⊣e‿c m.Set𝕩} 2⊸|◶{𝕊: (l⊸B+r⊸B)c-1}‿{𝕊: (2024×e) B c-1} d
}
zwei ⇐ +´inp B¨ 75
eins ⇐ +´inp B¨ 25
}
XI _is 11
#+end_src

#+RESULTS:
: ⟨ 199982 237149922829154 ⟩

#+BEGIN_EXPORT html
<div style="text-align: center; font-size: 2em; padding: 20px 0;">
<a href="https://panadestein.github.io/blog/" style="text-decoration: none;">⊑∘∞</a>
Expand Down
14 changes: 14 additions & 0 deletions src/bqn/aoc24.bqn
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,17 @@ X ← {
zwei+´ (inp=0) × (inp=9) DP´9
}
X _is 10

XI ← {
inp•ParseFloat¨' 'Split⊑•Flines Input𝕩m•HashMap˜⟨⟩
B ← {
𝕨𝕊𝕩: m.Has𝕨𝕩 ? m.Get𝕨𝕩;
·𝕊0: 1;
0𝕊𝕩: 𝕩{𝕩 𝕨m.Set𝕩}1𝕊𝕩-1;
e𝕊c: lre (÷⋈|˜) 10⋆⌊2÷˜d1+10e
{𝕩ec m.Set𝕩} 2|{𝕊: (lB+rB)c-1}‿{𝕊: (2024×e) B c-1} d
}
zwei+´inp B¨ 75
eins+´inp B¨ 25
}
XI _is 11

0 comments on commit 3a89f4b

Please sign in to comment.