# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
14215 | 2015-05-05T07:33:00 Z | Fakeable | 중앙값 배열 (balkan11_medians) | C++ | 33 ms | 1312 KB |
#include<cstdio> bool chk[200200]; int main() { int n,front; scanf("%d",&n); int left=1, right=2*n-1; scanf("%d",&front); printf("%d ",front); chk[front]=true; int mid=front; for(int i=1;i<n;i++) { scanf("%d",&front); if(!chk[front]) { printf("%d ",front); chk[front]=true; if(front<mid) { while(chk[left]) left++; chk[left]=true; printf("%d ",left); } else { while(chk[right]) right--; chk[right]=true; printf("%d ",right); } } else if(front==mid) { while(chk[left]) left++; while(chk[right]) right--; chk[left]=chk[right]=true; printf("%d %d ",left,right); } else if(front<mid) { while(chk[left]) left++; chk[left]=true; printf("%d ",left); while(chk[left]) left++; chk[left]=true; printf("%d ",left); } else { while(chk[right]) right--; chk[right]=true; printf("%d ",right); while(chk[right]) right--; chk[right]=true; printf("%d ",right); } mid=front; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1312 KB | Output is correct |
2 | Correct | 0 ms | 1312 KB | Output is correct |
3 | Correct | 0 ms | 1312 KB | Output is correct |
4 | Correct | 0 ms | 1312 KB | Output is correct |
5 | Correct | 0 ms | 1312 KB | Output is correct |
6 | Correct | 0 ms | 1312 KB | Output is correct |
7 | Correct | 0 ms | 1312 KB | Output is correct |
8 | Correct | 0 ms | 1312 KB | Output is correct |
9 | Correct | 0 ms | 1312 KB | Output is correct |
10 | Correct | 0 ms | 1312 KB | Output is correct |
11 | Correct | 0 ms | 1312 KB | Output is correct |
12 | Correct | 0 ms | 1312 KB | Output is correct |
13 | Correct | 0 ms | 1312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1312 KB | Output is correct |
2 | Correct | 0 ms | 1312 KB | Output is correct |
3 | Correct | 0 ms | 1312 KB | Output is correct |
4 | Correct | 9 ms | 1312 KB | Output is correct |
5 | Correct | 9 ms | 1312 KB | Output is correct |
6 | Correct | 19 ms | 1312 KB | Output is correct |
7 | Correct | 33 ms | 1312 KB | Output is correct |