Submission #101475

# Submission time Handle Problem Language Result Execution time Memory
101475 2019-03-19T03:00:08 Z rainy Cake (CEOI14_cake) C++14
0 / 100
2000 ms 2988 KB
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int N,Q,A;
int d[250000],od[250000];
char aa;int bb,cc;

void proc(){
    int st=A,en=A;od[A]=0;int nesf=1;
    while(st!=0||en!=N-1){
        //printf("(%d,%d)\n",st,en);
        if(st==0){
            en++;od[en]=nesf;
        }
        else if(en==N-1){
            st--;od[st]=nesf;
        }
        else if(d[st-1]<d[en+1]){
            st--;od[st]=nesf;
        }
        else{
            en++;od[en]=nesf;
        }
        nesf++;
    }
}

int main(){
    scanf("%d%d",&N,&A);A--;
    for(int i=0;i<N;i++)scanf("%d",&d[i]);
    scanf("%d",&Q);

    proc();
    for(int it=0;it<Q;it++){
        scanf(" %c",&aa);
        if(aa=='F'){
            scanf("%d",&bb);bb--;
            printf("%d\n",od[bb]);
        }
        else{
            scanf("%d%d",&bb,&cc);
            bb--;
            int orr=d[bb];
            cc=N-orr+1;
            d[bb]=cc;
            for(int i=0;i<N;i++){
                if(d[i]<=orr&&d[i]>cc&&i!=bb)d[i]++;
                //printf("[%d:%d]\n",i,d[i]);
            }
            proc();
        }
    }
    return 0;
}

Compilation message

cake.cpp: In function 'int main()':
cake.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&N,&A);A--;
     ~~~~~^~~~~~~~~~~~~~
cake.cpp:32:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<N;i++)scanf("%d",&d[i]);
                         ~~~~~^~~~~~~~~~~~
cake.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&Q);
     ~~~~~^~~~~~~~~
cake.cpp:37:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %c",&aa);
         ~~~~~^~~~~~~~~~~
cake.cpp:39:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&bb);bb--;
             ~~~~~^~~~~~~~~~
cake.cpp:43:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d",&bb,&cc);
             ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2059 ms 384 KB Time limit exceeded
2 Execution timed out 2050 ms 384 KB Time limit exceeded
3 Execution timed out 2044 ms 504 KB Time limit exceeded
4 Execution timed out 2016 ms 384 KB Time limit exceeded
5 Execution timed out 2037 ms 632 KB Time limit exceeded
6 Execution timed out 2037 ms 512 KB Time limit exceeded
7 Execution timed out 2049 ms 512 KB Time limit exceeded
8 Execution timed out 2033 ms 588 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 1656 KB Output isn't correct
2 Incorrect 60 ms 1504 KB Output isn't correct
3 Incorrect 82 ms 1400 KB Output isn't correct
4 Incorrect 3 ms 384 KB Output isn't correct
5 Incorrect 126 ms 2988 KB Output isn't correct
6 Incorrect 179 ms 2980 KB Output isn't correct
7 Incorrect 93 ms 2424 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 275 ms 476 KB Output isn't correct
2 Incorrect 458 ms 824 KB Output isn't correct
3 Execution timed out 2041 ms 1016 KB Time limit exceeded
4 Execution timed out 2035 ms 1016 KB Time limit exceeded
5 Incorrect 583 ms 636 KB Output isn't correct
6 Execution timed out 2037 ms 1260 KB Time limit exceeded
7 Execution timed out 2050 ms 816 KB Time limit exceeded
8 Execution timed out 2060 ms 1024 KB Time limit exceeded
9 Execution timed out 2061 ms 2424 KB Time limit exceeded
10 Incorrect 1823 ms 1656 KB Output isn't correct
11 Execution timed out 2019 ms 864 KB Time limit exceeded
12 Execution timed out 2023 ms 1932 KB Time limit exceeded
13 Execution timed out 2037 ms 2308 KB Time limit exceeded