You are given with an array a of size n along with q set of operations. An operation is denoted by 3 integers
Answers
Answered by
1
First line contains two space-separated integers N and Q, denoting the number of elements in array and number of queries respectively.
Next line contains N space-separated integers denoting elements of the array.
Next Q lines contain a single integer K.
Output:
For each task, print answer in a new line.
Constraints:
2 <= N <= 105
1 <= Q <= 105
0 <= A[i] <= 109
0 <= K < N
Explanation
After 1st operation, the array will become, A = [3,2,4,4]. So, sum of elements = 13.
After 2nd operation, the array will become, A = [3,2,4]. So, sum of elements = 9.
Anonymous:
say something yaar
Similar questions