Watch
1
0
Fork
You've already forked advent-of-code
0
advent-of-code/2025/day01.ua
2025-12-08 01:56:00 -06:00

39 lines
838 B
Text
Raw Permalink 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.

~ "aoc.ua" ~ Lines
Input ← Lines &fras "input/day01.txt"
Dirs ← ≡°□ +⊃(¯=@L) (=@R) ⍚⊢
Amts ← ⋕⍚(↘ 1)
Ops ← × ⊃Dirs Amts
Part₁ ← (
⬚50\(◿100 +)
/+ =0
)
Div ← ⌊⌵÷
Rem ← ×⊃(◿⊙⌵|±⋅)
DivRem ← ⊂ ⊃(Div|Rem)
ChSgn ← ≠∩±
NeitherZero ← |2 =0 +∩(=0)
CrossedZero ← |2 ×⊃(NeitherZero|ChSgn)
TouchedZero ← |2 × ≠0 ⊙(=0)
Update ← |2 Rem100 + Rem100 # op pos
Z₁ ← |2 Div100 ⊙◌ # op [pos]
Z₂ ← |2 Div100 +Rem100 # op pos
Z₃ ← |2 TouchedZero ⟜+Rem100 # op pos
Z₄ ← |2 CrossedZero ⟜+Rem100 # op pos
Part₂ ← (
⬚[0 50] /(|2
⊃(⊡0|⊡1)
⊙(⊂⊂⊂ ⊃(Z₁|Z₂|Z₃|Z₄|Update))
˜∧+
)
)
Part₁ Ops Input
Part₂ Ops Input