report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Copying data - FlandreOJ: Flandre 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 ```
Introduction to Segment Tree and Binary Indexed Tree
Point update, sum query
Point update, minimum query
Range update, sum query
Range update, minimum query
Apple picking
Non-negative subarray
Inversions
K-query
Divisible by 3
Mushroom harvesting
KSS
D-query
Greatest subarray sum
Copying data
Within 1
Within 2
Ladder update
Racing
One time
Subarray XOR
String sorting
Odd query
Full sequence
Topic
Data structure
Rating 1600
Source Codeforces
Solution (0) Solution