ANONYMOUS wrote:
> Hi, just wondering why the input time is taken into account in the total time. For flip, just processing the input takes about 5 seconds for a 1000x1000 grid, and the actual algorithm part takes about 8 seconds. All together it is over 10 seconds hence hits time limit but the algorithm part is under 10 seconds. Do we need to optimise it so that it is under 10 seconds all together? Thanks
Reasonable input times are accounted for in the runtime limits, and should rarely if ever be the dominating factor. The time limits and bounds are set so as to distinguish algorithms with acceptable time complexities from those that are too slow.
Given that many of the accepted submissions for FLIP are able to solve each test case in under a second (and the best takes 0.6 seconds at worst), I believe that your code for processing the input is unnecessarily inefficient.
DOMjudge is only able to assess the runtime of your total program, including input, so yes, you must read the input, solve the problem, and output the answer within the time limit.
Cheers,
Gozz