Last active
December 13, 2022 18:58
-
-
Save LdBeth/a4ccfe85c2f39c26dd68b271d50531e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data←⊃⎕NGET'input.txt'1 | |
⎕io←0 | |
test←⎕D⍳↑map | |
⍝ P1 | |
+/{a←test[⊃⍵;] ⋄ b←test[;⊃⌽⍵] ⋄ i←⍵⌷test ⋄ ∨/∧/¨i>((⊃⍵)↑b)((1+⊃⍵)↓b)((⊃⌽⍵)↑a)((1+⊃⌽⍵)↓a)}¨,⍳⍴test | |
⍝ P2 | |
⌈/{a←test[⊃⍵;] ⋄ b←test[;⊃⌽⍵] ⋄ i←⍵⌷test ⋄ ×/((1++/)⌊≢)¨∧\¨i>(⌽(⊃⍵)↑b)((1+⊃⍵)↓b)(⌽(⊃⌽⍵)↑a)((1+⊃⌽⍵)↓a)}¨,⍳⍴test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment