Watch
1
0
Fork
You've already forked advent-of-code
0

2025 Day 8 Part 2

This commit is contained in:
Jeremy Kaplan 2025-12-20 19:37:11 -05:00
commit 3293478996

View file

@ -6,25 +6,48 @@ Junctions ← ≡◇⊜⋕ ⊸≠@, Input
Distance ← √ /+ ⁿ2 - Distance ← √ /+ ⁿ2 -
Dist₂ ← /+ ⁿ2 - Dist₂ ← /+ ⁿ2 -
≡(□¤) Junctions Part₁ ← (
⊙⟜≡(□¤)
°⊏ Junctions ⊙(
°⊏
⊏ ⧅< 2 ⊏ ⧅< 2
⊏⍏⊸≡(Distance°[⊙⊙]) ⊏⍏⊸≡(Distance°[⊙⊙])
)
⟜↙
↙ 1000 ⊙⊃(⋅∘|∘)
⍥₁₀₀₀( ⍥(
⊃(↘1|⊢) ⊙⊃(¤⊢|↘1)
⊙(
⊃(⋅∘|¤∘)
⤚≡(/↥◇∊) ⤚≡(/↥◇∊)
⊃(▽|▽¬) ⊃(▽|▽¬)
/⍚⊂ /⍚⊂
) )
)
˙⍤=0⧻ ⊙(˙⍤=0⧻)
/×↙¯3⍆≡◇⧻ /×↙¯3⍆≡◇⧻
)
Part₂ ← (
⟜≡(□¤)
⊏ ⧅< 2 °⊏
⊏⍏⊸≡(Distance°[⊙⊙])
# Edges Forest
⊃(⋅∘|∘)
# Forest Edges 0
⍢(⊙⊃(¤⊢|↘1|×∩⊢°[⊙⊙]⊢)
⤚≡(/↥◇∊)
⊃(▽|▽¬)
/⍚⊂
| >1◇⧻
)
)
&s Part₁ 1000 Junctions
&s Part₂ Junctions