Comments
0

You can read editorial, in which proves why it enough to add $$$(l, l - 1)$$$ and $$$(r, r + 1)$$$ edges

0

You need to try add edges $$$(r, r + 1)$$$ too.

+244

Yes, the author's solution in C was incorrect. We haven't noticed it in 9 months. We stressed this solution (as it turned out, we stressed it terribly), I even wrote an analysis with a proof of this greed. Now an exercise for the reader, find the error in this tutorial:

Tutorial

The most cyan round ever. It will be interesting!

The most unbalanced and unprincipled round I've ever seen, change my mind...

As a tester, I don't remember tasks.

spoiler
  1. Yep, this is error. The initial task was to assign on the way to the root, where it was necessary to write the transfusion technique, in this section I made a mistake with the addition.
  2. This works because we will add +x to the ancestors of u, v until we reach the lca ancestor, where we need to end the adding.
  3. We contain segment_tree in global and updating his in dfs, this is q log q

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

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

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

I do not consider the Fenwick tree and the non-recursive segment tree to be similar in structure.

All good, but benchmark have 1 error: Fenwick != Segment tree

On AmShZCodeforces Round #800, 4 years ago
+15

Another div1 with trygub support? It will be fine.

+12

This was very interesting and good round! Thanks for this tasks.