#include <bits/stdc++.h>
#define int long long
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int N = (500*500)+1;
const int inf = 1e9;
const int mod=1e9+7;
struct edge{
int v,w;
};
bool cmp(edge a,edge b){
return a.w<=b.w;
}
vector<int>v;
int dp[2005];
signed main(){
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
boost
int n,m;
cin>>n>>m;
v.push_back(0);
for(int i=1;i<=n;i++){
int x;
cin>>x;
v.push_back(x);
}
for(int i=1;i<=m;i++){
int x;
cin>>x;
if(x==1){
int pos,val;
cin>>pos>>val;
v[pos]=val;
continue;
}else{
int y;
cin>>y;
int ans=0;
for(int i=1;i<n;i++){
int l=min(v[i],v[i+1]);
int r=max(v[i],v[i+1]);
if(l<=y&&y<=r){
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... |