답안 #171061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171061 2019-12-27T09:26:42 Z mosiashvililuka Simple game (IZhO17_game) C++14
22 / 100
1000 ms 1316 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Execution timed out 1082 ms 1316 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Execution timed out 1082 ms 1316 KB Time limit exceeded
9 Halted 0 ms 0 KB -