# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
25955 | 2017-06-25T08:04:11 Z | 서규호(#1088) | 케이크 (CEOI14_cake) | C++14 | 2000 ms | 5592 KB |
#include <bits/stdc++.h> #define lld long long #define pp pair<int,int> #define pb push_back #define MOD 1000000007 #define left lleft #define right rright #define INF 2000000000 #define Linf 1000000000000000000LL #define next nnext #define minus mminus using namespace std; int N,M,Q,K; int a[250002],ans[250002]; vector<int> X; void process(){ int l,r; l = M; r = M; while(r-l != N-1){ if(l == 1 || (r != N && a[r+1] < a[l-1])){ r++; ans[r] = r-l; }else{ l--; ans[l] = r-l; } } } int main(){ scanf("%d %d",&N,&M); for(int i=1; i<=N; i++){ scanf("%d",&a[i]); X.pb(a[i]); } sort(X.begin(),X.end()); for(int i=1; i<=N; i++){ a[i] = lower_bound(X.begin(),X.end(),a[i])-X.begin()+1; } process(); scanf("%d",&Q); for(int i=1; i<=Q; i++){ int x,y,t,t2; char op[3]; scanf("%s %d",op,&x); if(op[0] == 'F'){ printf("%d\n",ans[x]); }else{ scanf("%d",&y); y = N-y+1; if(x == M) continue; for(int j=1; j<=N; j++){ if(a[x] < a[j] && a[j] <= y){ a[j]--; } } a[x] = y; process(); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3972 KB | Output is correct |
2 | Correct | 0 ms | 3972 KB | Output is correct |
3 | Correct | 0 ms | 3972 KB | Output is correct |
4 | Incorrect | 16 ms | 3972 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2000 ms | 4112 KB | Execution timed out |
2 | Execution timed out | 2000 ms | 4112 KB | Execution timed out |
3 | Execution timed out | 2000 ms | 4112 KB | Execution timed out |
4 | Execution timed out | 2000 ms | 4112 KB | Execution timed out |
5 | Execution timed out | 2000 ms | 4244 KB | Execution timed out |
6 | Execution timed out | 2000 ms | 4244 KB | Execution timed out |
7 | Execution timed out | 2000 ms | 4244 KB | Execution timed out |
8 | Execution timed out | 2000 ms | 4244 KB | Execution timed out |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 149 ms | 4824 KB | Output is correct |
2 | Correct | 89 ms | 4824 KB | Output is correct |
3 | Correct | 99 ms | 4824 KB | Output is correct |
4 | Correct | 0 ms | 3972 KB | Output is correct |
5 | Correct | 256 ms | 5592 KB | Output is correct |
6 | Correct | 253 ms | 5592 KB | Output is correct |
7 | Correct | 186 ms | 5592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 489 ms | 3972 KB | Output isn't correct |
2 | Incorrect | 809 ms | 4112 KB | Output isn't correct |
3 | Execution timed out | 2000 ms | 4440 KB | Execution timed out |
4 | Execution timed out | 2000 ms | 4440 KB | Execution timed out |
5 | Incorrect | 1036 ms | 3972 KB | Output isn't correct |
6 | Execution timed out | 2000 ms | 4824 KB | Execution timed out |
7 | Execution timed out | 2000 ms | 4112 KB | Execution timed out |
8 | Execution timed out | 2000 ms | 4824 KB | Execution timed out |
9 | Execution timed out | 2000 ms | 5592 KB | Execution timed out |
10 | Execution timed out | 2000 ms | 3972 KB | Execution timed out |
11 | Execution timed out | 2000 ms | 4244 KB | Execution timed out |
12 | Execution timed out | 2000 ms | 5592 KB | Execution timed out |
13 | Execution timed out | 2000 ms | 5592 KB | Execution timed out |