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

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

Problem Statement: Click

It definitely requires convex hull optimization, but I'm not sure how to merge the sets properly. I've thought about the usual "merge the small subtree to the large subtree" trick, but it doesn't seem to work. Is there anything I'm missing? And also, which variant of the convex hull optimization should I use? Does it require the fully dynamic variant?

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

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

You can view judge solutions and I/O here: http://serjudging.vanb.org/?cat=28

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

    Thanks, but it there also an explanation available?

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

      I haven't solved it yet, but my teammate tells me it uses centroid decomposition.

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

        No wonder I couldn't solve it. Anyways, the solution looked like it used a special trick with DSU. I'm not sure what that's about though.

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

It can be solved with static version of convex hull trick where you can pre-sort slopes. You want to combine it with centroid decomposition. It's simplified when you notice that you don't have to consider strict paths. Walks that have repeated edges are always worse than paths with no repeated edges.

»
2 года назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

I would like to share my AC code, for those who get stuck with the problem and cannot find any code on the net like me.

code