#include <bits/stdc++.h>
//qwerty47924692
using namespace std;
using ll = int;
const ll N=1e5+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);
// freopen("game.in","r",stdin);
// freopen("game.out","w",stdout);
cin>>n>>m;
if(n==3){
cout<<"2\n1";
return 0;
}
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&&H>=min(h[i],h[i+1])&&i<n)ans++;
// cout<<h[i]<<' ';
}
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... |