Leftmost Big Enough
Support U i v (assign ai = v) and Q x — print the SMALLEST index whose value is ≥ x, or −1.
Input: the first line has N and Q; the second line has the array; each of the next Q lines is an operation.
Output: one line per query.
Constraints:
- 1 ≤ N, Q ≤ 105
- |values|, |x| ≤ 106
Sample Tests
Input 1
5 3 3 1 4 1 5 Q 4 U 3 0 Q 4
Output 1
3 5
Input 2
1 1 5 Q 6
Output 2
-1
Discussion (opens after you solve — no spoilers before)
No comments yet.