Sequence
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
64bit IO Format: %lld

题目描述

Given an array a consisting of n integers, on which you are to perform m operations of two types.

1.Given two integers x,y, replace the number of index x with number y. That is ax:=y.

2.Given one integer x, print the number of consecutive subsequences of a, whose minimum value equals to ax.

It's guaranteed that there are no duplicated value in array a at any moment.

输入描述:

The first line contains two intergers n,m(1≤n,m≤105),where n is the size of the array and m is the number of operations to perform.
The second line contains n integer, the ith integer is ai (1≤ai≤231-1)

Then,m lines follow, describing m operation you are to perform in order.
Each line start with an integer opt∈[1,2], meaning the type of operation to perform.

If opt=1,two integers x, y (1≤x≤n,1≤y≤231-1) follows,mentioned above.
If opt=2,one integers x (1≤x≤n) follows, mentioned above.

输出描述:

For each operation of type 2, print one integer on one line as the answer.

示例1

输入

复制
10 5
8 3 6 2 10 9 5 7 1 4 
2 2
1 9 11
1 5 12
2 4
1 8 18

输出

复制
4
28