#K95647. Process Operations on an Integer Sequence
Process Operations on an Integer Sequence
Process Operations on an Integer Sequence
You are given a sequence (B) of (m) integers and a series of (p) operations. There are two types of operations:\
- (\text{add}(i, x)): Add the integer (x) to element (B[i]).\
- (\text{get}(i)): Output the current value of (B[i]).\
The operations will be provided in order. For each (\text{get}(i)) operation, you are to output the value at position (i) in the sequence at that moment.\
Note that the indices are zero-indexed. Your program must read input from standard input and output all answers to standard output.
inputFormat
The input is given via standard input in the following format:\ \\nThe first line contains an integer (m), denoting the number of elements in the sequence.\ The second line contains (m) space-separated integers representing the initial sequence (B).\ The third line contains an integer (p), denoting the number of operations.\ Each of the following (p) lines contains three space-separated integers: (op), (i), and (x). Here, (op = 0) represents an add operation (\text{add}(i, x)) and (op = 1) represents a get operation (\text{get}(i)) (in which case (x) is ignored).
outputFormat
For each (\text{get}(i)) operation, output the corresponding value from the sequence (B) on a separate line. If there are no get operations, do not output anything.## sample
5
2 4 -1 3 6
4
0 3 2
1 3 0
0 2 -3
1 2 0
5
-4
</p>