Блог пользователя ____noOne____

Автор ____noOne____, история, 6 лет назад, По-английски

I am getting TLE in test case 11 in this 35599469 problem. Is there any way to increase every value of an array by some value without running any loop?

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

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by ____noOne____ (previous revision, new revision, compare).

»
6 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Take an extra variable say, bonus

For each type 2 update increase bonus by y

Then for each query on ith index it is  = a[i] + bonus

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't have time to see your submission, but you can use any range query data structure like BIT, or segment tree. But this problem is not that difficult, see the editorial.