Sereja and Vectors - TLE - for doing nothing - need advise

Does it make sense that I get TLE with 31 sec, when my program only read the input and print ‘0’?
[ I’m reading with BufferedReader(new InputStreamReader( ]

You need to print “0” and flush the output stream immediately after read input of each testcase, otherwise your program will be blocked reading next input. (Because the judge is blocked reading your output before giving out the input of next testcase).
Your program flow should be as below:

  1. Read number of testcases;
  2. For each testcase:
  3. a) Read input
  4. b) Print your output
  5. c) Flush the output stream

are u sure we need to flush the op stream…i havent done that and it runs fine…!!!

it depends on buffering mode. for line buffered stream, it is flushed automatically when it encounters newline, so it may be ok to omit flush in this case.

Oh, no. I do not think so. You don’t need to flush the output each time. The program is not blocked from reading input, if we don’t do the output. That happens, when we have an interactive judge (like we had in some older long contests). This question is not using an interactive judge. So, you can take input as you like and output as you like. The stream of output is all that matters.

The OJ doesn’t require you to flush op stream (except for interactive problems). I have been using StringBuilder all these while and usually flush it only at the end of the solution.