답안 #101579

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101579 2019-03-19T04:38:57 Z rainy 케이크 (CEOI14_cake) C++14
0 / 100
2000 ms 2692 KB
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 250005
using namespace std;
int N,A,Q,d[MAXN],od[MAXN];

int main(){
    scanf("%d%d",&N,&A);
    for(int i=1;i<=N;i++)scanf("%d",&d[i]);
    scanf("%d",&Q);
    bool prevE=true;
    int I=-1,E=-1;
    for(int i=0;i<Q;i++){
        char inp;
        scanf("  %c",&inp);
        if(inp=='E'){
            prevE=true;
            scanf("%d%d",&I,&E);
        }
        else{
            int B;scanf("%d",&B);
            if(prevE){
                if(I!=-1&&E!=-1){
                    int orr=d[I];
                    d[I]=N-E+1;
                    for(int j=0;j<N;j++){
                        if(j!=I&&d[j]>orr&&d[j]<=d[I])d[j]--;
                    }
                }
                int s=A,e=A,sf=1;
                while(s!=1||e!=N){
                    if(s==1){
                        e++;od[e]=sf;
                    }
                    else if(e==N){
                        s--;od[s]=sf;
                    }
                    else if(d[s-1]<d[e+1]){
                        s--;od[s]=sf;
                    }
                    else{
                        e++;od[e]=sf;
                    }
                    sf++;
                }
            }
            printf("%d\n",od[B]);
        }
    }
    return 0;
}

Compilation message

cake.cpp: In function 'int main()':
cake.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&N,&A);
     ~~~~~^~~~~~~~~~~~~~
cake.cpp:10:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=N;i++)scanf("%d",&d[i]);
                          ~~~~~^~~~~~~~~~~~
cake.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&Q);
     ~~~~~^~~~~~~~~
cake.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("  %c",&inp);
         ~~~~~^~~~~~~~~~~~~
cake.cpp:19:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d",&I,&E);
             ~~~~~^~~~~~~~~~~~~~
cake.cpp:22:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             int B;scanf("%d",&B);
                   ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 132 ms 384 KB Output isn't correct
2 Incorrect 175 ms 428 KB Output isn't correct
3 Incorrect 148 ms 384 KB Output isn't correct
4 Correct 117 ms 384 KB Output is correct
5 Incorrect 151 ms 544 KB Output isn't correct
6 Incorrect 157 ms 632 KB Output isn't correct
7 Incorrect 137 ms 552 KB Output isn't correct
8 Correct 204 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2098 ms 1284 KB Time limit exceeded
2 Execution timed out 2009 ms 1428 KB Time limit exceeded
3 Execution timed out 2017 ms 1300 KB Time limit exceeded
4 Incorrect 2 ms 384 KB Output isn't correct
5 Execution timed out 2023 ms 2448 KB Time limit exceeded
6 Execution timed out 2052 ms 2408 KB Time limit exceeded
7 Execution timed out 2045 ms 2424 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Incorrect 260 ms 504 KB Output isn't correct
2 Incorrect 432 ms 504 KB Output isn't correct
3 Execution timed out 2023 ms 1144 KB Time limit exceeded
4 Execution timed out 2020 ms 1132 KB Time limit exceeded
5 Incorrect 578 ms 760 KB Output isn't correct
6 Execution timed out 2011 ms 1144 KB Time limit exceeded
7 Execution timed out 2043 ms 964 KB Time limit exceeded
8 Incorrect 652 ms 1272 KB Output isn't correct
9 Execution timed out 2037 ms 2424 KB Time limit exceeded
10 Incorrect 1965 ms 1716 KB Output isn't correct
11 Execution timed out 2028 ms 968 KB Time limit exceeded
12 Execution timed out 2033 ms 2272 KB Time limit exceeded
13 Execution timed out 2057 ms 2692 KB Time limit exceeded