[Haskell-cafe] Slow IO

Tom Phoenix rootbeer at redcat.com
Mon Sep 11 12:22:58 EDT 2006

On 9/11/06, Daniel Fischer <daniel.is.fischer at web.de> wrote:

> The problem spec states that the input file contains about 500 test cases,
> each given by between 1 and 100,000 lines, each line containing a single word
> of between 2 and 1000 letters.
> So the file should be about 12.5G on average.

I don't think that that necessarily follows. Although I've never seen
the input file, of course, I imagine that many cases are fairly small,
but designed to test the accuracy of your algorithm. A few are large
(in one way or another) to test the extremes of your algorithm. But
the overall size of the input file is probably much, much smaller than
that estimate. (Maybe 1MB? Maybe 10MB?)

> A time limit of 7s is given.

That's CPU time, and thus not including I/O, right? I couldn't find
the answer on the SPOJ site. Their FAQ is a forum, but I don't see it


In any case, the problem can't be too large; the top twenty programs
all finished in under 0.35 (CPU seconds?). Even if yours is a tenth as
fast as the C and C++ programs, that would be 3.5s -- twice as fast as
it needs to be.


Of course, you don't have access to these other programs for
comparison; but I hope that this gives you a better idea of the size
(and manageability) of the task.

Good luck with it!

--Tom Phoenix

More information about the Haskell-Cafe mailing list