Skip to content

Instantly share code, notes, and snippets.

@wsgac
Created August 1, 2019 12:15
Show Gist options
  • Select an option

  • Save wsgac/0c010fa1c6a492c01dac8b2e2076a613 to your computer and use it in GitHub Desktop.

Select an option

Save wsgac/0c010fa1c6a492c01dac8b2e2076a613 to your computer and use it in GitHub Desktop.
PicoLisp solution for the ABC problem on Kattis
# 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