2025 Day 5 Part 2
This commit is contained in:
parent
91111e567c
commit
bb2cca8a31
1 changed files with 29 additions and 1 deletions
|
|
@ -12,4 +12,32 @@ Items ←
|
|||
|
||||
Contains ← ×⊃(≤⊙⊢|≥⊙⊣)
|
||||
|
||||
/+ ≡(>₀/+) ⊞Contains Items Ranges
|
||||
Part₁ ← /+ ≡(>₀/+) ⊞Contains Items
|
||||
|
||||
# Overlaps ? A B
|
||||
Overlap ← ≤ ⊣ ⊙⊢
|
||||
|
||||
# Range ? A B
|
||||
Join ← ⊂⊃(/↧⊂⊢⊙⊢|/↥⊂⊣⊙⊣)
|
||||
|
||||
Part₂ ← (
|
||||
⍢(
|
||||
| # Changed Ranges' ? Ranges
|
||||
⍆
|
||||
⊸(↘₋₁⟜↘₁)
|
||||
˜⊂0≡Overlap
|
||||
˜⨂ 1
|
||||
⤚≠ ⊙⊸⧻
|
||||
⨬(⋅0
|
||||
| ⊃(↙
|
||||
| ¤ Join °⊟⊏ ⊂⟜+₁
|
||||
| ↘+₂)
|
||||
⊂⊂
|
||||
1
|
||||
)
|
||||
)
|
||||
/+ ≡(+₁ -⊃⊢⊣)
|
||||
)
|
||||
|
||||
Part₁ Ranges
|
||||
Part₂ Ranges
|
||||
|
|
|
|||
Loading…
Reference in a new issue