Submission #171059

#TimeUsernameProblemLanguageResultExecution timeMemory
171059mosiashvililukaSimple game (IZhO17_game)C++14
0 / 100
7 ms504 KiB
#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; } f[a+1]=f[a]+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++){ if(f[q]<=f[q+1]){ zx=f[q];xc=f[q+1]; /*upd(f[q],1); upd(f[q+1],-1);*/ }else{ zx=f[q+1]+1;xc=f[q]+1; /*upd(f[q+1]+1,1); upd(f[q]+1,-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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...