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

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

I am looking for problems that have a long, error-prone, or difficult solution(preferably the "obvious" solution) without 2D segtrees. However, the problem should also have some solution with 2D segtrees that can easily copy-paste a segment tree of fenwick tree's code (2D segment trees on sums, for instance), resulting in shorter coding time should you have the code ready. The segtree solution can be complete overkill, but as long as it takes less time to code (given the tree code) than another common solution, the problem is great.

For example, Algorithmic Crush is a great example of a problem that has a simple solution without segtrees (scroll down to this problem), but a shorter solution with a 1D segtree, provided youve coded it before and only need a few tweaks. I would like similar problems, but for 2D segtrees.

Also, the problem can be hosted anywhere (CF, TopCoder, HackerRank, etc.) so long as it has an editorial or solution somewhere.

Полный текст и комментарии »

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

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

I know many problems that can be solved by segtrees, but I am looking for a collection of problems that can be solved with segtrees that also have a shorter & easier-to-come-up-with sqrt(n) decomposition solution. Even one or two would be great, and they don't have to be from CF but should have a place with a solution/editorial.

Полный текст и комментарии »

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

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

I know there are many segtree problems on cf, but is there a collection of segtree problems that have much more brief solutions using C++'s standard set? Even one or two would be great, and they don't have to be from CF but should have a place with a solution/editorial.

One great example is USACO 2015 Dec. — High Card Low Card (Problem), whose solution uses segtrees but has a much more brief solution with sets. (Solution)

Полный текст и комментарии »

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