A Query Problem.

Revision en1, by dreamplay, 2018-03-06 23:04:28

Hey there.

I have the following problem, not from any ongoing or past contest. Can you help me, by suggesting what optimal methods you have to solve it.

Node has three properties: left, right, height

N Insert node queries. Each query is (l, r, h).

Now M queries ask following: L, R, H
For all nodes(l, r, h), that satisfy L <= l && r <= R,
return min( abs( H — h) )

Can you guys suggest some approaches that you have in mind?

Tags #data structure, #algorithms, #doubt, complexity optimization

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English dreamplay 2018-03-06 23:04:28 478 Initial revision (published)