답안 #101423

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101423 2019-03-19T01:37:14 Z rainy 케이크 (CEOI14_cake) C++14
0 / 100
2000 ms 2976 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);
             ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2029 ms 456 KB Time limit exceeded
2 Execution timed out 2067 ms 384 KB Time limit exceeded
3 Execution timed out 2066 ms 384 KB Time limit exceeded
4 Execution timed out 2028 ms 384 KB Time limit exceeded
5 Execution timed out 2017 ms 536 KB Time limit exceeded
6 Execution timed out 2041 ms 512 KB Time limit exceeded
7 Execution timed out 2052 ms 512 KB Time limit exceeded
8 Execution timed out 2048 ms 512 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Incorrect 83 ms 1720 KB Output isn't correct
2 Incorrect 68 ms 1472 KB Output isn't correct
3 Incorrect 58 ms 1400 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 133 ms 2976 KB Output isn't correct
6 Incorrect 142 ms 2936 KB Output isn't correct
7 Incorrect 97 ms 2428 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 271 ms 632 KB Output isn't correct
2 Incorrect 430 ms 504 KB Output isn't correct
3 Execution timed out 2047 ms 888 KB Time limit exceeded
4 Execution timed out 2051 ms 1148 KB Time limit exceeded
5 Incorrect 592 ms 788 KB Output isn't correct
6 Execution timed out 2012 ms 1132 KB Time limit exceeded
7 Execution timed out 2065 ms 820 KB Time limit exceeded
8 Execution timed out 2045 ms 1024 KB Time limit exceeded
9 Execution timed out 2029 ms 2552 KB Time limit exceeded
10 Execution timed out 2005 ms 1492 KB Time limit exceeded
11 Execution timed out 2025 ms 840 KB Time limit exceeded
12 Execution timed out 2043 ms 2268 KB Time limit exceeded
13 Execution timed out 2044 ms 2308 KB Time limit exceeded