rand's blog

By rand, history, 3 weeks ago, translation, In English

Hi codeforces!

I recently wrote sqrt-decomposition + dsu, and I only had to use snm if the query contains the whole block. What would be the asymptotics of this solution?

It may seem obvious to you that the asymptotics will be $$$O(n \cdot \sqrt{n \cdot \varphi^{-1} {(n)}})$$$ ($$$\varphi^{-1} {(n)}$$$ — the inverse Ackerman function).

But in fact the asymptotics is — $$$O(n \cdot B \cdot \varphi^{-1}{(n)} + \frac{n ^ 2}{B})$$$ ($$$B$$$ — block size) and in order to achieve the asymptotics with an accreman under the sqrt we need to know $$$\varphi^{-1}{(n)}$$$ to put $$$B = \sqrt{n * \varphi^{-1}{-1} {(n)}}$$$, and to do that we need to know $$$\varphi^{-1} {(n)}$$$. So it comes down to a quick calculation of $$$\varphi^{-1} {(n)}$$$. Is it possible to do this?

Full text and comments »

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