#SGM0000044. Sao chép dữ liệu (Copying Data)
Sao chép dữ liệu (Copying Data)
Copying Data
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given arrays and , copy a subarray of into a corresponding subarray of and query single positions of .
Input
The first line contains , followed by arrays and . Queries are:
1 x y k: for , set .2 x: print .
Every copy range is guaranteed to fit both arrays.
Output
Print one line for every type 2 query.
Subtasks
- 20 points: .
- 30 points: .
- 50 points: , .
Examples
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
Explanation
Copy operations never modify ; they only replace covered positions of . Because copy ranges may overlap, a point query must use the most recent assignment covering that position. The outputs are 0 3 -1 3 2 3 -1.