Tree's problem related to number of distinct vertices's value on simple path

Правка en1, от autumncloud8, 2017-12-25 15:50:30

Problem: For a tree with n vertices. Every vertex has a value in range [1, c]. We define d(u, v) is number of distinct vertices's value on simple path from u to v, and . We have to calculate all sum(i), 1 ≤ i ≤ n.

Constraints: 1 ≤ n ≤ 100000, 1 ≤ c ≤ 300000.

Do you have any idea?

Теги tree, distinct value, shortest path, simple path

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский autumncloud8 2017-12-25 15:50:30 431 Initial revision (published)