SPOJ LISA : Max done. Memoize it.