[Haskell-cafe] Slow IO or bad code?

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu Aug 9 08:25:42 EDT 2007


j.vimal:
> Hi
> I am practicing writing code in haskell, by solving problems at this
> site. http://spoj.pl.
> The problem http://spoj.pl/problems/FASHION , is pretty simple.
> 
> 1. Given two lists A,B , of N numbers, sort them and take sum of products.
>     i.e. Sum ai * bi
> 
> I wrote a code, but seems to give "Time limit exceeded"!

We have a page for these SPOJ problems:

    http://haskell.org/haskellwiki/SPOJ#Techniques_for_dealing_with_problems_efficiently

With bytestring IO, you can aim to be around the speed of OCaml or C++,
according to the existing bytestring entries.

-- Don


More information about the Haskell-Cafe mailing list