You are given a number $n$ and a number $m$ and an array $a$ of $n$ numbers and 1 type of query. All of the numbers below are 0 based indexing.↵
↵
1) Given 3 numbers, $l$, $r$ , $x$. You add all the numbers from l to r(inclusive) by x. For example if the initial array was {5, 4, 3, 9, 2} and the query was {0, 2, 5} then the array would become {10, 9, 8, 9, 2}. Also, print the array.↵
↵
After each query, store the new array as array $a$.↵
↵
At the end print the array a.↵
↵
m describes the number of queries being asked.↵
↵
Example:↵
↵
~~~~~↵
4 3↵
1 9 2 2↵
2 2 3↵
0 3 5↵
2↵
Output:↵
↵
10↵
6 14 10 7↵
~~~~~↵
↵
Should be less that $O(n^{2})$
↵
1) Given 3 numbers, $l$, $r$ , $x$. You add all the numbers from l to r(inclusive) by x. For example if the initial array was {5, 4, 3, 9, 2} and the query was {0, 2, 5} then the array would become {10, 9, 8, 9, 2}. Also, print the array.↵
↵
After each query, store the new array as array $a$.↵
↵
At the end print the array a.↵
↵
m describes the number of queries being asked.↵
↵
Example:↵
↵
~~~~~↵
4 3↵
1 9 2 2↵
2 2 3↵
0 3 5↵
2↵
Output:↵
↵
10↵
6 14 10 7↵
~~~~~↵
↵
Should be less that $O(n