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

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

Hi

These are some problems about Centroid Decomposition , you can learn this algorithm here .

Its complexity is O(nlogn)

I hope these problems would be useful for you :)

If there are another problems on CF please put it on comment !!

UPD : The list has been updated

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

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

Great job :D Thank you :)

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

Here's a nice problem about Centroid Decomposition : Race (although it's from IOI '11 not codeforces)

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

The complexity is always O(nlogn) ?

So it doesn't depend on the problem or on the requested queries ?

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

    Lol, don't try to memorize it. Understand why it is O(N*logN). You build the centroid-decomposition-tree. The tree has logN levels. From each level, you do a DFS and visit atmost N nodes in total. So, you perform NlogN operations. If you do other stuff while visiting the nodes, the complexity will change too. For example, if after visiting each node, you insert into some global set, you introduce another logN factor. So, yes, it depends on the problem and the requested queries. O(NlogN) is just the bound on the total number of nodes you visit during the DFSs (a particular node may be visited multiple times from different centroids).

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

Mahmoud and a xor trip usually fails with cd due to the tight time limit. O(nlognlogM) is sadly too much.

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

    I don't understand why you'd solve 766E - Mahmoud and a xor trip using CD anyway. In problems where simple dynamic programming suffices, there's no need to go through the hassle of implementing centroid decomposiotion. Reserve it for problems where all paths rooted at some vertex can't be represented by 2 integers total.

    (I guess practicing CD is a reason enough. Still, I'd explore simpler solutions.)

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

      I ain't gonna solve it using cd :D

      I'm just warning since I've seen many cd-oriented solutions failing with TLE here.

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

if you want you can add these problems :

150E — Freezing with Style

293E — Close Vertices

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

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

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

why just problems on CF ?

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

Tree2 from Timus can be solved using multiple techniques and Centroid Decomposition is one of them

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

    Can you elaborate on your approach? I solved it using CD, however my solution is a bit slow(0.3 seconds, there are submissions in less than 0.1)? What is your complexity?

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

Can anyone help me with Centroid Decomposition approach to the problem 161D("Distance in Tree")(http://codeforces.com/contest/161/problem/D)

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

Don't get angry if I mention this problem even if it's not on CF: I think is very interesting Centroid Decomposition problem, and it's pretty difficult. https://csacademy.com/contest/archive/task/flareon

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

Can someone explain the solution of 766E — Mahmoud and a xor trip with Centroid Decomposition? Thanks in advance!

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

Can anyone tell the centroid decomposition solution to 161D? I did it using a n*k dp.

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

766E , centroid decomposition is not fast enough..

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

1156D - 0-1-Tree also can be solved using Centroid Decomposition.

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

A recent problem of CF 563 Div2 : F. Ehab and the Big Finale

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

If anyone have solved all the questions then please share the submission link.