Croc Champ 2013 - Round 1
E
Copying Data
Codeforces
1900
原题
← D→
翻译中…

We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come up with a way to copy some part of a number array into another one, quickly.

翻译中…

More formally, you've got two arrays of integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ and $*b*_{1}, *b*_{2}, ..., *b*_{*n*}$ of length $*n*$. Also, you've got $*m*$ queries of two types:

翻译中…
  1. Copy the subsegment of array $*a*$ of length $*k*$, starting from position $*x*$, into array $*b*$, starting from position $*y*$, that is, execute $*b*_{*y* + *q*} = *a*_{*x* + *q*}$ for all integer $*q*$ $(0 ≤ *q* < *k*)$. The given operation is correct — both subsegments do not touch unexistent elements.
  2. Determine the value in position $*x*$ of array $*b*$, that is, find value $*b*_{*x*}$.
翻译中…

For each query of the second type print the result — the value of the corresponding element of array $*b*$.

翻译中…

Input

翻译中…

The first line contains two space-separated integers $*n*$ and $*m*$ $(1 ≤ *n*, *m* ≤ 10^{5})$ — the number of elements in the arrays and the number of queries, correspondingly. The second line contains an array of integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(|*a*_{*i*}| ≤ 10^{9})$. The third line contains an array of integers $*b*_{1}, *b*_{2}, ..., *b*_{*n*}$ $(|*b*_{*i*}| ≤ 10^{9})$.

翻译中…

Next $*m*$ lines contain the descriptions of the queries. The $*i*$-th line first contains integer $*t*_{*i*}$ — the type of the $*i*$-th query $(1 ≤ *t*_{*i*} ≤ 2)$. If $*t*_{*i*} = 1$, then the $*i*$-th query means the copying operation. If $*t*_{*i*} = 2$, then the $*i*$-th query means taking the value in array $*b*$. If $*t*_{*i*} = 1$, then the query type is followed by three integers $*x*_{*i*}, *y*_{*i*}, *k*_{*i*}$ $(1 ≤ *x*_{*i*}, *y*_{*i*}, *k*_{*i*} ≤ *n*)$ — the parameters of the copying query. If $*t*_{*i*} = 2$, then the query type is followed by integer $*x*_{*i*}$ $(1 ≤ *x*_{*i*} ≤ *n*)$ — the position in array $*b*$.

翻译中…

All numbers in the lines are separated with single spaces. It is guaranteed that all the queries are correct, that is, the copying borders fit into the borders of arrays $*a*$ and $*b*$.

翻译中…

Output

翻译中…

For each second type query print the result on a single line.

翻译中…

样例

Input #1
5 10
1 2 0 -1 3
3 1 5 -2 0
2 5
1 3 3 3
2 5
2 4
2 1
1 2 1 4
2 1
2 4
1 4 2 1
2 2
Output #1
0
3
-1
3
2
3
-1
InputCopy OutputCopy
题目信息
题号
292E
时间限制
2 s
内存限制
256 MB
标签
数据结构

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