DS that supports 2 queries

Правка en1, от Qualified, 2020-10-11 04:26:42

I want a data structure that supports 2 queries. One of them is an update in which we update the element at position $$$a$$$ to $$$b$$$. The second query is getting the index of the maximum element in the range $$$[l, r]$$$. For the second query, if there are 2 elements with the same value and that value is the maximum, output the minimal index. Examples: Initial array = [5, 4, 3, 9]. Do first query $$$2, 4$$$. array = [5, 4, 4, 9]. Do second query(0, 3). Answer = 3. Do first query $$$0, 100$$$. array = [100, 4, 4, 9]. Do first query $$$3, 100$$$. array = [100, 4, 4, 100]. Do second query(0, 1). Answer = 0.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Qualified 2020-10-11 15:19:51 0 (published)
en2 Английский Qualified 2020-10-11 15:19:38 131 (saved to drafts)
en1 Английский Qualified 2020-10-11 04:26:42 617 Initial revision (published)