MTX_AS's blog

By MTX_AS, history, 3 years ago, In English

Problem: here

Submission link: here

Why I think it shouldn't exceed the limit:

Let's look at my query function (it does the queries):

function code

now the solve function:

solve() code

So, I don't get a runtime error due to the assertions. But it should work, because $$$t<=10^4$$$ times we do at most $$$2$$$ queries, and we do also some build queries, which are $$$\leq 4\cdot10^4$$$. $$$2\cdot 10^4 + 4\cdot 10^4 = 6\cdot 10^4$$$, which is the maximal number of queries possible. Have you got any ideas what's wrong here? Help would be really appreciated. Thank you.

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

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by MTX_AS (previous revision, new revision, compare).

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by MTX_AS (previous revision, new revision, compare).

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

You call query() $$$n$$$ times in the first for-loop, and assert didn't fall because $$$curQueries$$$ is initially equal to $$$-\infty$$$ (the second assert didn't fall because the program just didn't reach this line). Note that $$$n$$$ can be more than $$$6 \cdot 10^4$$$.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you! I somehow calculated that $$$\frac{2\cdot 10^5}{3} = 4\cdot 10^4$$$, while it's not true. (btw, how to write rounding down in LaTeX?)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by MTX_AS (previous revision, new revision, compare).