You have an array of
INCREMENT l r a
- For each index
SUM l r
- Compute the sum of the integers between indices
Constraints
Input Specification
The first line contains two positive integers,
The next INCREMENT
operation.
Otherwise, the first integer in the line is SUM
operation.
Output Specification
For each SUM
operation, output on its own line the result of the query.
Sample Input
Copy
3 4
1 2 3 2
2 1 1
2 2 2
2 3 3
Sample Output
Copy
0
2
4
Comments
I am assuming the array starts at index 0?
Can anyone tell me why I'm TLEing on testcase 5? I know there's some sort of optimization but I don't know the specifics.
Your time complexity is currently
, which is insufficient given the constraints (this is on the order of 
operations, give or take). If you are stumped, you can try reading the tutorial :)).