Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

eftikhar_azim's blog

By eftikhar_azim, history, 10 months ago, In English,

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?

 
 
 
 
  • Vote: I like it  
  • +2
  • Vote: I do not like it  

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
10 months ago, # |
  Vote: I like it +5 Vote: I do not like it

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

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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.