# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
101596 | 2019-03-19T04:54:03 Z | rainy | 케이크 (CEOI14_cake) | C++14 | 2000 ms | 26348 KB |
#include<cstdio> #include<cstring> #include<algorithm> #include<map> #define MAXN 250005 using namespace std; int N,A,Q,d[MAXN],od[MAXN]; map<int,int>dtp; int main(){ scanf("%d%d",&N,&A); for(int i=1;i<=N;i++){ scanf("%d",&d[i]); dtp[d[i]]=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'){ if(prevE){ if(I!=-1&&E!=-1){ int orr=d[I]; d[I]=N-E+1; map<int,int>temp=dtp; dtp[d[I]]=I; for(int j=orr+1;j<d[I];j++){ int pos=temp[j]; d[pos]--; dtp[j]=pos; } } 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++; } } 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; map<int,int>temp=dtp; dtp[d[I]]=I; for(int j=orr+1;j<d[I];j++){ int pos=temp[j]; d[pos]--; dtp[j]=pos; } } 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]); prevE=false; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2016 ms | 1268 KB | Time limit exceeded |
2 | Execution timed out | 2044 ms | 1280 KB | Time limit exceeded |
3 | Execution timed out | 2033 ms | 1368 KB | Time limit exceeded |
4 | Execution timed out | 2025 ms | 1368 KB | Time limit exceeded |
5 | Execution timed out | 2016 ms | 2816 KB | Time limit exceeded |
6 | Execution timed out | 2043 ms | 2936 KB | Time limit exceeded |
7 | Execution timed out | 2041 ms | 2816 KB | Time limit exceeded |
8 | Execution timed out | 2045 ms | 2900 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2037 ms | 10880 KB | Time limit exceeded |
2 | Incorrect | 1402 ms | 11148 KB | Output isn't correct |
3 | Incorrect | 1027 ms | 11104 KB | Output isn't correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Execution timed out | 2031 ms | 26200 KB | Time limit exceeded |
6 | Execution timed out | 2028 ms | 26076 KB | Time limit exceeded |
7 | Execution timed out | 2033 ms | 26348 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2035 ms | 952 KB | Time limit exceeded |
2 | Execution timed out | 2021 ms | 900 KB | Time limit exceeded |
3 | Execution timed out | 2024 ms | 5368 KB | Time limit exceeded |
4 | Execution timed out | 2037 ms | 5376 KB | Time limit exceeded |
5 | Execution timed out | 2031 ms | 924 KB | Time limit exceeded |
6 | Execution timed out | 2028 ms | 6904 KB | Time limit exceeded |
7 | Execution timed out | 2040 ms | 1280 KB | Time limit exceeded |
8 | Execution timed out | 2045 ms | 10616 KB | Time limit exceeded |
9 | Execution timed out | 2033 ms | 25800 KB | Time limit exceeded |
10 | Execution timed out | 2040 ms | 1092 KB | Time limit exceeded |
11 | Execution timed out | 2037 ms | 2304 KB | Time limit exceeded |
12 | Execution timed out | 2059 ms | 20596 KB | Time limit exceeded |
13 | Execution timed out | 2100 ms | 25724 KB | Time limit exceeded |