Submit solution
Points:
100
Time limit:
2.0s
PyPy 3
5.0s
Python 3
5.0s
Memory limit:
977M
Author:
Problem type
Range Updates?
Given an array of integers, compute the following queries:
- Increase the values from by .
- What is the value at position .
Input
The first line conatins the integer .
The second line contains the integers within the array: .
The third line contains the integer .
The following lines contains either " " or " ", representing each type of query.
Output
For each query of type 2, output the value at position .
Constraints
Hint: Try to change this from a range-update point-query problem, into a point-update range-query problem. (or don't)
Example 1
Input
5
8 8 6 7 9
10
1 1 4 3
1 4 5 9
1 1 4 1
2 4
2 3
2 3
2 2
1 1 2 9
1 4 5 1
2 5
Output
20
10
10
12
19
Comments