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

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

I just encountered a difficult problem with no solution. Can someone help me, thanks in advance.

Given a tree with N vertices. There are Q queries, the ith query is represented by K pairs (v, r), all vertices whose distance from v is not more than r will be marked. Ask how many vertices are marked per query. Limit N <= 5e4, Q <= 5e5 + N, the total K of all queries does not exceed 5e5 + N.

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

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

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

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

Centroid decomposition

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

Hint: Centroid decomposition. For every ancestor of node in centroid tree, count vertices with appropriate distance. Sort of like the famous problem Xenia and Tree