Copying data - MarisaOJ: Marisa Online Judge

Copying data

Time limit: 1000 ms
Memory limit: 256 MB
You are given 2 arrays $A, B$ of $n$ integers. There are $q$ queries of either form: - `1 x y k`: assign $A_{x+t}$ to $B_{y+t}$ for $0 \le t < k$. - `2 i`: find the value $B_i$. ### Input - The first line contains 2 integers $n, q$. - The second line contains $n$ integers $A_i$. - The third line contains $n$ integers $B_i$. - The next $q$ lines, each line contains 4 or 2 integers depends on query type. ### Output - Print each query of type $2$, print the answer. ### Constraints - $1 \le n, q\le 10^5$. - $1 \le x, y \le n$. - $1 \le x + k-1, y+k-1\le n$ - $0 \le |A_i| \le 10^9$. ### Example Input: ``` 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: ``` 0 3 -1 3 2 3 -1 ```