Codeforces Round 187 (Div. 2)
B
Sereja and Array
Codeforces
1200
原题
← AC →
翻译中…

Sereja has got an array, consisting of $*n*$ integers, $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. Sereja is an active boy, so he is now going to complete $*m*$ operations. Each operation will have one of the three forms:

翻译中…
  1. Make $*v*_{*i*}$-th array element equal to $*x*_{*i*}$. In other words, perform the assignment $*a*_{*v*_{*i*}} = *x*_{*i*}$.
  2. Increase each array element by $*y*_{*i*}$. In other words, perform $*n*$ assignments $*a*_{*i*} = *a*_{*i*} + *y*_{*i*}$ $(1 ≤ *i* ≤ *n*)$.
  3. Take a piece of paper and write out the $*q*_{*i*}$-th array element. That is, the element $*a*_{*q*_{*i*}}$.
翻译中…

Help Sereja, complete all his operations.

翻译中…

Input

翻译中…

The first line contains integers $*n*$, $*m*$ $(1 ≤ *n*, *m* ≤ 10^{5})$. The second line contains $*n*$ space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(1 ≤ *a*_{*i*} ≤ 10^{9})$ — the original array.

翻译中…

Next $*m*$ lines describe operations, the $*i*$-th line describes the $*i*$-th operation. The first number in the $*i*$-th line is integer $*t*_{*i*}$ $(1 ≤ *t*_{*i*} ≤ 3)$ that represents the operation type. If $*t*_{*i*} = 1$, then it is followed by two integers $*v*_{*i*}$ and $*x*_{*i*}$, $(1 ≤ *v*_{*i*} ≤ *n*, 1 ≤ *x*_{*i*} ≤ 10^{9})$. If $*t*_{*i*} = 2$, then it is followed by integer $*y*_{*i*}$ $(1 ≤ *y*_{*i*} ≤ 10^{4})$. And if $*t*_{*i*} = 3$, then it is followed by integer $*q*_{*i*}$ $(1 ≤ *q*_{*i*} ≤ *n*)$.

翻译中…

Output

翻译中…

For each third type operation print value $*a*_{*q*_{*i*}}$. Print the values in the order, in which the corresponding queries follow in the input.

翻译中…

样例

Input #1
10 11
1 2 3 4 5 6 7 8 9 10
3 2
3 9
2 10
3 1
3 10
1 1 10
2 10
2 10
3 1
3 10
3 9
Output #1
2
9
11
20
30
40
39
InputCopy OutputCopy
题目信息
题号
315B
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。