#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6+5;
bool chck(int x1,int x2, int c) {
return ((x1>=c && x2<=c) || (x2>=c && x1<=c));
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,q; cin>>n>>q;
int a[n];
for (int i = 0; i<n; i++) cin>>a[i];
if (n<=1000 && q<=1000) {
while(q--) {
int x; cin>>x;
if (x==1) {
int x1,y1; cin>>x1>>y1;
a[x1-1]=y1;
} else {
int h; cin>>h;
int sum=0;
for (int i = 1; i<n; i++) {
if (chck(a[i-1],a[i],h)) sum++;
}
cout<<sum<<'\n';
}
}
} else {
cout<<"DAUTBOLAT";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |