mufaddalnaya's blog

By mufaddalnaya, history, 6 years ago, In English

I've tried submitting a solution to problem 1146C — Tree Diameter Submission

But I get Idleness limit exceeded on test 1, I tested my code using Custom Test, but it seems to be working Okay, how can I fix this?

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it +13 Vote: I do not like it

After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

fflush(stdout) or cout.flush() in C++;
System.out.flush() in Java;
flush(output) in Pascal;
stdout.flush() in Python;
see documentation for other languages.
  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, I got the mistake. By mistake I printed new line after flushing which caused the error.