# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
25953 | 2017-06-25T07:59:24 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 == 0 || (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; printf("%d\n",y); 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 | Incorrect | 0 ms | 3972 KB | Output isn't correct |
2 | 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 | Incorrect | 146 ms | 4824 KB | Output isn't correct |
2 | Incorrect | 123 ms | 4824 KB | Output isn't correct |
3 | Incorrect | 86 ms | 4824 KB | Output isn't correct |
4 | Incorrect | 0 ms | 3972 KB | Output isn't correct |
5 | Incorrect | 246 ms | 5592 KB | Output isn't correct |
6 | Incorrect | 269 ms | 5592 KB | Output isn't correct |
7 | Incorrect | 179 ms | 5592 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 516 ms | 3972 KB | Output isn't correct |
2 | Incorrect | 839 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 | 996 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 |