language: Haskell (ghc-6.8.2)
date: 125 days 23 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
data Instruction = X | Y deriving Show
 
breadthSearch target ((path, (x,y)):paths)
    | x == target = reverse path
    | otherwise = breadthSearch target $
                  paths ++ [(X:path, (x+y, y))
                           ,(Y:path, (x, x+y))]
 
main = do
  value <- getContents
  print $ breadthSearch (read value) [([],(1,1))]
  • upload with new input
  • result: Success     time: 2.32s    memory: 7816 kB     returned value: 0

    500
    [X,X,X,X,Y,X,Y,X,Y,X,Y,X,Y,X]