#ds104. 树状数组二分
树状数组二分
Fenwick Tree Binary Search
Problem Description
You are given numbers .
You must support operations:
1 x d: set .2 s: find the largest () 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 s, with , , and .
Output Format
For each query, output one line containing the answer.
Sample Input
5 5
1 2 3 4 5
2 6
2 5
1 1 100
2 10
2 1000
Sample Output
3
2
0
5
Constraints
, , , .