Skip to content

Commit

Permalink
feat: 9 at 22ms.
Browse files Browse the repository at this point in the history
  • Loading branch information
Panadestein committed Dec 9, 2024
1 parent 9b83b1c commit eaa4c84
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/aoc24.org
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ to get more context. These definitions and imports are shared by the various puz

#+begin_src bqn :tangle ./bqn/aoc24.bqn
IX ← {
f‿s ← <˘⍉↑‿2⥊•ParseFloat∘⋈¨ ⊑•FLines Input𝕩
m ← ¯1=d ← ∾⥊⍉ds ← (⊔˜/f)≍¯1¨∘↕¨s
ds ⊣ {n𝕊cf: (p<n)∧(≠f)>p←⊑1⊐˜(≠cf)≤+´¨¯1=1⊸⊏ds?
ds{cf«𝕩}⌾(1‿p⊸⊑){¯1¨𝕩}⌾(0‿n⊸⊑)ds⋄@; @
f‿s ← <˘⍉↑‿2⥊•ParseFloat∘⋈¨⊑•FLines Input𝕩
m ← ¯1=d ← ∾⥊⍉ds ← (⊔˜/f)≍¯1¨∘↕¨sm ← s
ds ⊣ {n𝕊cf: (p<n)∧(≠f)>p←⊑1⊐˜cf≠⊸≤sm?
ds({cf«𝕩}⌾(1‿p⊸⊑){¯1¨𝕩}⌾(0‿n⊸⊑))↩ ⋄ @⊣sm{𝕩-≠cf}⌾(p⊸⊑)↩; @
}´˘(⊢≍˘˜·⌽⊒˜)⌽⊏ds
eins ⇐ {+´/(𝕩-˜≠d)↑(d׬m)+(𝕩↑⌽/f)⌾(m⊸/)m}+´s
zwei ⇐ +´/(⊢ׯ1⊸≠)∾⥊⍉{𝕊⟨⟩:𝕩;(⌽∘⊣∾⊢)´𝕩⊔˜𝕩=¯1}¨⌾(1⊸⊏)ds
eins ⇐ {+´(⊢×↕∘≠)(𝕩-˜≠d)↑(𝕩↑⌽/f)⌾(m⊸/)d}+´s
zwei ⇐ +´(⊢×↕∘≠)(⊢ׯ1⊸≠)∾⥊⍉{𝕊⟨⟩:𝕩;(⌽∘⊣∾⊢)´𝕩⊔˜𝕩=¯1}¨⌾(1⊸⊏)ds
}
IX _is 9
#+end_src
Expand Down
12 changes: 6 additions & 6 deletions src/bqn/aoc24.bqn
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ VIII ← {
VIII _is 8

IX ← {
fs<˘⍉↑2⥊•ParseFloat¨ ⊑•FLines Input𝕩
m¯1=d∾⥊⍉ds ← (˜/f)¯1¨¨s
ds {n𝕊cf: (p<n)(f)>p1˜(cf)≤+´¨¯1=1ds?
ds{cf«𝕩}(1p){¯1¨𝕩}(0n)ds⋄@; @
fs<˘⍉↑2⥊•ParseFloat¨⊑•FLines Input𝕩
m¯1=d∾⥊⍉ds ← (˜/f)¯1¨¨sms
ds {n𝕊cf: (p<n)(f)>p1˜cfsm?
ds({cf«𝕩}(1p){¯1¨𝕩}(0n))↩ ⋄ @sm{𝕩-≠cf}(p)↩; @
}´˘(⊢≍˘˜·⌽⊒˜)⌽⊏ds
eins ⇐ {+´/(𝕩-˜d)(d׬m)+(𝕩↑⌽/f)(m/)m}+´s
zwei+´/(⊢ׯ1)∾⥊⍉{𝕊⟨⟩:𝕩;(⊣∾⊢)´𝕩˜𝕩=¯1}¨(1)ds
eins ⇐ {+´(⊢×↕)(𝕩-˜d)(𝕩↑⌽/f)(m/)d}+´s
zwei+´(⊢×↕)(⊢ׯ1)∾⥊⍉{𝕊⟨⟩:𝕩;(⊣∾⊢)´𝕩˜𝕩=¯1}¨(1)ds
}
IX _is 9

0 comments on commit eaa4c84

Please sign in to comment.