I'm working on a problem right now (specifically 10006) and I'm trying to improve my time by experimenting with various input/output routines. What I'm doing at the moment is alternating calls between gets and fwrite. This is quite fast but what I'd rather do is have one large call to fread that puts all the input into a buffer and then one call to fwrite that has access to an output buffer I've created. I've tested this alternate input method on my home machine with the following code added (and an appropriate infile...):
#ifndef ONLINE_JUDGE
freopen("infile.txt", "r", stdin);
freopen("outfile.txt", "w", stdout);
#endif
On my machine the code works just as it should with an infile covering all strange cases I can think up. However, the online judge just hangs and I get a TLE. Does the online judge REQUIRE that we alternate between inputs and outputs or have I come across something obscure?
