#include <bits/stdc++.h>
//qwerty47924692
using namespace std;
using ll = int;
const ll N=1e6+29;
const string br="617283";
#define sz(a)(ll)a.size()
#define f first
#define s second
ll n,m,cnt[N],h[N];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m;
for(ll i=1;i<=n;i++){
cin>>h[i];
}for(ll i=1;i<=m;i++){
ll t;
cin>>t;
if(t==1){
ll pos,val;
cin>>pos>>val;
h[pos]=val;
}else{
ll H;
cin>>H;
ll ans=0;
for(ll i=1;i<n;i++){
if(max(h[i],h[i+1])>=H>=min(h[i],h[i+1]))ans++;
}
cout<<ans<<'\n';
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |