You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2023/uiua/day_11.ua

11 lines
524 B

12 months ago
MappedIndices ← +⊃(\+×≡/×=@.)(⇡⧻): -1
Input ← &fras "../day_11.txt"
⊜∘≠, @\n Input # split on newlines
↯¯1_2⊞⊂ ∩(MappedIndices 1000000) ⊃∘⍉ . # mapped indices
▽=@#♭: # galaxy indices
↯¯1_2_2⊠⊟. # pairs of galaxies
⊝≡(⊏⍏.) # unique pairs
≡(/+⌵-°⊟) # distances between pairs
/+ # sum