LeoLeuLeo0's blog

By LeoLeuLeo0, history, 2 years ago, In English

Given an array of N numbers, all of which are initially 0. You need to process 2 types of queries: • Query type 1 has the form 1 L R A B, we add to the ith element (i − L)A + B the unit with all L <= i <= R • Type 2 query has the form 2 L R, we need to print the sum of the elements in the range [L..R], get the remainder for 10^9 + 7. Input data • The first line contains 2 numbers N and M which are the number of elements in the array and the number of queries (1 N, M 105 ). • The next M lines each record a query in one of the two categories above. • The numbers in the input are all greater than or equal to 1 and less than or equal to 10^9 . Result out • For each type 2 query, write 1 line of the answer

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You should check out ITLADDER problem. It's a good segment tree one.