Could it be possible to have a more recent version of the HP and/or the containers package for the Haskell environment ? Without any of them there are no acceptable key/value stores, and all graph-related problems become hugely annoying.
Yes sure. We could do it in October. What packages should be included?
Just add lens and everything will follow
More seriously, I just started with the challenges, so I might miss something. But having some kind of key/value store is critical. Having lens would be extremely nice too, so if I was to choose, I would add these four, ordered by priority :
- unordered-containers (this one is present in recent platforms)
- containers (it has built-in support for graphs, which is useful)
- lens (this will bring a ton of things, but is mighty handy)
- multiset (I saw there was a scrabble problem ;))
The current Haskell platform available for the contests does include the containers module (Map, Set, Graph, etc.). Lens is indeed not available, but I’m not sure it would bring so much to solve the highly algorithmic problems found on Codingame. Until now, I didn’t encounter anything requiring more than simple simple flat records. Like I already said though, I’m far to be a Haskell guru, so maybe I’m too newbie to know of better ways to solve them.
For some reason I was certain containers wasn’t included
The lens dependency would be useful for all the range of traversals; prisms, and its dependencies, not the actual lenses.
It is an old version of containers, which explains why I couldn’t include Data.Map.Strict !
It would actually be nice to have a more recent compiler too !
I have an optimized solution for the “Roller Coaster” problem that I believe should be fast enough but that timeouts on the site :
$ ghc --version ; ghc -rtsopts -Wall solver.hs && time ./solver +RTS -A512M -M512M < /tmp/case5 The Glorious Glasgow Haskell Compilation System, version 7.8.3 4999975000 ./solver +RTS -A512M -M512M < /tmp/case5 0,01s user 0,00s system 88% cpu 0,014 total
Humm just compiled it with GHC 7.4.1 and it’s fast on my computer … not sure what the problem is here.
Unfortunately your solution probably isn’t optimized enough. If I’m correct, you have 2 seconds in Haskell to answer. To give you an idea of what an optimized solution can do, 2 seconds is the time my PHP solution takes (though 6 seconds are allowed) so you should definitely be able to take less than these 2 seconds
As seen on the previous post it takes 0.014 seconds on my computer. I don’t think the test platform is that slow. Something else is going on …
Ah I just changed computer and now the same program is slow … fun fun fun.
Well it was obviously a stupid mistake from me Sorry for the commotion.