Need help in a range query problem

Правка en1, от shreyk, 2025-04-02 23:11:57

Problem Link
Here is my approach:
Suppose for the $$$i$$$th operation the value is $$$y_i$$$ for $$$x_i$$$ coordinate then for every $$$x_j$$$ > $$$x_i$$$ their $$$y$$$ coordinate value gets updated to $$$2y_i-y_j$$$. So, the value for $$$y$$$ gets updated in a fashion $$$2y_1-2y_2+2y_3... - y_0$$$ for $$$x_0$$$. I can't think of a way to implement this alternating sign change pattern. Kindly help.

Теги range query, segment tree

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский shreyk 2025-04-02 23:11:57 453 Initial revision (published)