10282: CF EDU - Segment Tree P2 - Step 1 - B. Applying MAX to Segment
[Creator : ]
Description
There is an array of $n$ elements, initially filled with zeros. You need to write a data structure that processes two types of queries:
- for all $i$ from $l$ to $r−1$ do the operation $a_i=\text{max}(a_i,v)$,
- find the current value of element $i$.
Input
The first line contains two numbers $n, m\ (1≤n,m≤100,000)$, the size of the array and the number of operations.
The following lines contain the desc
- 1 l r v: for all $i$ from $l$ to $r−1$ do the operation $a_i=\text{max}(a_i,v)\ (0≤l<r≤n,\ 0≤v≤10^9)$.
- 2 i: find the value of the element with index $i\ (0≤i<n)$.
Output
For each operation of the second type, print the corresponding value.
Sample 1 Input
5 5
1 0 3 3
2 1
1 2 4 4
2 3
2 4
Sample 1 Output
3
4
0