Created
August 1, 2019 12:15
-
-
Save wsgac/0c010fa1c6a492c01dac8b2e2076a613 to your computer and use it in GitHub Desktop.
PicoLisp solution for the ABC problem on Kattis
This file contains hidden or 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
| # Kattis - ABC | |
| # https://open.kattis.com/problems/abc | |
| (de getInput () | |
| (let (Numbers (sort (list (read) (read) (read))) | |
| Seq (chop (read)) | |
| Alist (mapcar '((K V) (cons K V)) '("A" "B" "C") Numbers)) | |
| (list Alist Seq))) | |
| (de processInput(Numbers Sequence) | |
| (mapc '((S) (printsp (cdr (assoc S Numbers)))) Sequence)) | |
| # (apply processInput (getInput)) | |
| # Test invocations | |
| #{ | |
| (in '(echo "-e" "1 5 3\nABC") (apply processInput (getInput))) | |
| (in '(echo "-e" "6 4 2\nCAB) (apply processInput (getInput))) | |
| }# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment