Sanat's blog

By Sanat, history, 4 months ago, In English

I was practising a question from Atcoder abc287 f, while reading the editorial for this problem, I encountered something called "square-order tree DP" due to it, by doing a process, which seems O(n^3) at first glance is actually O(n^2) they had linked a blog about it, but it is in Japanese, and I wasn't able to find a relevant resource related to it, in English, if someone, can help me find a relevant resource, or explain why the process is O(n^2) it would be very helpful.

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

»
4 months ago, # |
  Vote: I like it -47 Vote: I do not like it

"Sqrt Tree — Algorithms for Competitive Programming" https://cp-algorithms.com/data_structures/sqrt-tree.html This may help, although I understand nothing from this but I get it that it square roots the number of operations or something like that. Check it out

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +33 Vote: I do not like it

    thanks for your effort, but it is unrelated to what I asked

»
4 months ago, # |
  Vote: I like it +34 Vote: I do not like it

One of the first problems most people saw with this technique is probably https://codeforces.net/contest/815/problem/C. Also, https://usaco.guide/adv/comb-sub has a brief explanation and a set of problems with using this.

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    Thanks!!! I read the reason, it is indeed very elegant why it is O(n^2), no heavy calculations and only simple reasoning to arrive at it

»
4 months ago, # |
  Vote: I like it +31 Vote: I do not like it

If I understand it correctly, then an English resource is here (section 7).

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Thanks!!!, it is very useful, I was looking for something like this, nice explanation, I also found some more interesting things related to it in comments of your blog.