# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
65886 | 2018-08-09T05:32:42 Z | ikura355 | 케이크 (CEOI14_cake) | C++14 | 2000 ms | 31356 KB |
#include<bits/stdc++.h> using namespace std; const int maxn = 250000 + 5; int n,st,q; int a[maxn]; int pos[maxn]; int main() { scanf("%d%d",&n,&st); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) pos[n-a[i]+1] = i; scanf("%d",&q); for(int i=1;i<=n;i++) printf("%d ",pos[i]); printf("\n"); while(q--) { char type; scanf(" %c",&type); if(type=='F') { int x; scanf("%d",&x); if(x==st) printf("0\n"); else if(x>st) { int mx = 0, l = st; for(int i=st+1;i<=x;i++) mx = max(mx, a[i]); for(int i=st-1;i>=1;i--) { if(a[i]>mx) break; l = i; } printf("%d\n",x-l); } else { int mx = 0, r = st; for(int i=st-1;i>=x;i--) mx = max(mx, a[i]); for(int i=st+1;i<=n;i++) { if(a[i]>mx) break; r = i; } printf("%d\n",r-x); } } else { int x,ra; scanf("%d%d",&x,&ra); for(int i=ra-1;i>=1;i--) a[pos[i]]++; a[x] = a[pos[ra]]+1; for(int i=ra-1;i>=1;i--) pos[i] = pos[i+1]; pos[ra] = x; // for(int i=1;i<=n;i++) printf("%d ",pos[i]); // printf("\n"); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 230 ms | 2536 KB | Output isn't correct |
2 | Incorrect | 152 ms | 4792 KB | Output isn't correct |
3 | Incorrect | 142 ms | 6532 KB | Output isn't correct |
4 | Incorrect | 151 ms | 8596 KB | Output isn't correct |
5 | Incorrect | 197 ms | 12224 KB | Output isn't correct |
6 | Incorrect | 169 ms | 15728 KB | Output isn't correct |
7 | Incorrect | 151 ms | 19208 KB | Output isn't correct |
8 | Incorrect | 145 ms | 22944 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2062 ms | 24348 KB | Time limit exceeded |
2 | Execution timed out | 2043 ms | 24464 KB | Time limit exceeded |
3 | Execution timed out | 2060 ms | 24544 KB | Time limit exceeded |
4 | Incorrect | 3 ms | 24544 KB | Output isn't correct |
5 | Execution timed out | 2080 ms | 26484 KB | Time limit exceeded |
6 | Execution timed out | 2087 ms | 26544 KB | Time limit exceeded |
7 | Execution timed out | 2064 ms | 26612 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 26612 KB | Output isn't correct |
2 | Incorrect | 77 ms | 26612 KB | Output isn't correct |
3 | Incorrect | 859 ms | 26612 KB | Output isn't correct |
4 | Incorrect | 1046 ms | 26612 KB | Output isn't correct |
5 | Incorrect | 124 ms | 26612 KB | Output isn't correct |
6 | Execution timed out | 2040 ms | 26612 KB | Time limit exceeded |
7 | Incorrect | 541 ms | 26612 KB | Output isn't correct |
8 | Incorrect | 219 ms | 26612 KB | Output isn't correct |
9 | Execution timed out | 2073 ms | 28764 KB | Time limit exceeded |
10 | Incorrect | 392 ms | 28764 KB | Output isn't correct |
11 | Execution timed out | 2052 ms | 28764 KB | Time limit exceeded |
12 | Execution timed out | 2063 ms | 30496 KB | Time limit exceeded |
13 | Execution timed out | 2063 ms | 31356 KB | Time limit exceeded |