Nearest vertex in a tree with a smaller value

Правка en2, от dododo89, 2019-11-15 23:18:02

You are given a tree of $$$N<=10^6$$$ vertices. Each vertex of the tree contains a number $$$a[i]<=10^9$$$.You are given $$$M<=10^6$$$ queries: "Find the distance to nearest vertex to the vertex $$$V$$$, with the value less than $$$X<=10^9$$$?"

How this problem can be solved?

Теги #tree, #algorithms

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский dododo89 2019-11-15 23:18:02 4 Tiny change: 'he vertex u, with the' -> 'he vertex $V$, with the'
en1 Английский dododo89 2019-11-15 23:16:52 308 Initial revision (published)