This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,f[100009],tp,fen[200009],kk,zx,xc;
pair <int, int> p[100009];
map <int, int> m;
map <int, int>::iterator it;
void upd(int q, int w){
while(q<=kk){
fen[q]+=w;
q=q+(q&(-q));
}
}
int read(int q){
int jm=0;
while(q>=1){
jm+=fen[q];
q=q-(q&(-q));
}
return jm;
}
void mak(int q){
if(q<1) return;
if(f[q]<=f[q+1]){
upd(f[q],-1);
upd(f[q+1],1);
}else{
upd(f[q+1]+1,-1);
upd(f[q]+1,1);
}
}
void makt(int q){
if(q<1) return;
if(f[q]<=f[q+1]){
upd(f[q],1);
upd(f[q+1],-1);
}else{
upd(f[q+1]+1,1);
upd(f[q]+1,-1);
}
}
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>b;
//scanf("%d%d\n",&a,&b);
for(i=1; i<=a; i++){
cin>>f[i];
//scanf("%d",&f[i]);
m[f[i]]=1;
}
for(i=1; i<=b; i++){
//scanf("%d",&tp);
cin>>tp;
if(tp==2){
//scanf("%d\n",&c);
cin>>c;
d=0;
for(int q=1; q<a; q++){
zx=min(f[q],f[q+1]);
xc=max(f[q],f[q+1]);
if(zx<=c&&c<=xc) d++;
}
cout<<d<<endl;
}else{
//scanf("%d%d\n",&c,&d);
cin>>c>>d;
f[c]=d;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |