/*
|01|11|2010|
*/
#include <bits/stdc++.h>
#define ll long long
#define int ll
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define sp setprecision
#define stl(v) v.begin(),v.end()
#define stlr(v) v.rbegin(),v.rend()
#define b1cnt __builtin_popcount
using namespace std;
const int N=2512;
const int mod=1e9+7;
const int inf=1e18;
const int M=55;
int n,m;
int a[N];
void prob(){
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>a[i];
while(m--){
int q;
int x,y;
cin>>q;
if(q==1){
cin>>x>>y;
a[x]=y;
}
else{
cin>>x;
int ans=0;
for(int i=2;i<=n;i++){
if((a[i-1]>=x && a[i]<=x) || (a[i]>=x && a[i-1]<=x)) ans++;
}
cout<<ans<<"\n";
}
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t2=1;
// cin>>t2;
for(int test=1;test<=t2;test++){
prob();
}
}
// ▄▌▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█|
// ▄▄██▌█════Фура═с═Кодами════█|
// ▄▄▄▌▐██▌█═Приехала═Разгружаем═█|
// ███████▌█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█|
// ▀(@)▀▀▀▀▀▀▀(@)(@)▀▀▀▀▀▀▀▀▀▀▀(@)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |