Alternative solution to standard tree query problem?

Правка en1, от yyyvvvyyy, 2017-03-04 00:50:06

I was solving this problem which seemed like a pretty much standard problem of persistent segment tree but i came across this solution which seems to use some dfs ordering of nodes and i'm unable to figure out what is going on?

Problem: Given a tree (100000 nodes) and a value in each node, and for each query you are given 2 nodes and a value V , you have to find number of nodes whose value is less than V.

solution: https://www.hackerearth.com/challenge/college/programmers-parliament/algorithm/freaky-frequencies/submission/7492012/

This is my first time on codeforces. Thanks in advance

Теги #trees, #dfs, persistent segment tree, hld

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский yyyvvvyyy 2017-03-04 00:50:06 658 Initial revision (published)