Блог пользователя Saber.HMN

Автор Saber.HMN, история, 7 лет назад, По-английски

Given an array of size N.There can be multiple queries of the following types. 1 . Update(l, r, x) : Increment the a[i] (l <= i <= r) with value x. 2 . query(l, r): Find index of the maximum value in the array in a range l to r (both are included).

  • Проголосовать: нравится
  • -4
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +21 Проголосовать: не нравится

I can't understand your description. Can you post link to source?

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

This can be solved with SQRT decomposition , you just need to save the maximum value and the index with the maximum value for each block and it can be easily updated.