enormous data problem - lua

I’m have some trouble using Lua for the enormous data problem. I’m using io.read("*all") to pull in the data and then using string.gfind to pull off the integers. The code works, but I’m getting a TLE from the judge.

My code is located here: here

The judge indicates that I’m just over the time limit, 8.01 seconds. I’m not sure how to interpret that though. I guess several test files are run. Any thoughts? I sure would appreciate the advice.

BTW, I don’t see any valid Lua solutions posted for this problem.

Hello @leakedmemory,

Yes, every problem usually consists of several test case files, which means that the time shown by the judge on an AC answer it’s actually the sum of the time taken on all test case files…

Regarding Lua, well, I can’t really help you much, as I don’t know it, but I’d suggest you would read it’s official documentation to find if there are any faster I/O methods other than io.read…

As an example, in C++, users usually have the choice over 2 I/O methods, cin/cout (a slow method) and scanf()/printf() (a C input derived method, that’s usually faster)…

Hope you can solve your issue…

Best regards,

Bruno

1 Like

Thanks Bruno. At this point I believe the io method I’m using with read all is the fastest available in Lua which, in this case, simply isn’t fast enough.