#ds205. 线段树上二分
线段树上二分
Binary Search on Segment Tree
Problem Description
You are given numbers .
You must support operations:
1 x d: set .2 l r d: among , find the index of the first element that is ; if no such element exists, output . In other words, find the smallest () such that .
Input Format
The first line contains two integers and ().
The next line contains integers ().
The following lines each describe an operation of the form 1 x d or 2 l r d, with , , and .
Output Format
For each query, output one line containing the answer.
Sample Input
5 5
1 2 3 4 5
2 4 5 5
1 5 1
2 1 5 3
1 3 2
2 1 3 3
Sample Output
5
3
-1
Constraints
, , , .