Блог пользователя RP_9

Автор RP_9, история, 7 лет назад, По-английски

I have tried to submit the solution to the problem which is shown below. I tried a lot but still get idleness limit exceeded.

This is my solution link.

http://mirror.codeforces.com/contest/916/submission/35832727

Can somebody help me how to overcome this??

Thank you in advance.

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +20 Проголосовать: не нравится

The mentioned problem is an interactive problem. Every interactive problem on CF will contain the following text (or some variation of it) in the bottom of the statement. Here it says:

If the operation is a query, you should output the result of the query and flush the output stream before proceeding to the next operation. Otherwise, you may get the verdict Idleness Limit Exceed.

What you did in your code is solving the queries offline; you took all the queries and processed them together. In interactive problems you're not allowed to do that; you must output whenever the statement says it is necessary, and then flush the output (which is also explained in the problem statement), otherwise you get the verdict "Idleness limit exceeded".