답안 #31725

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31725 2017-09-03T00:05:35 Z simotion 중앙값 배열 (balkan11_medians) C++14
5 / 100
33 ms 2600 KB
#include <bits/stdc++.h>
using namespace std;
bool used[200005];
int inp[100000],n,li,hi;
int main() {
    scanf("%d",&n);
    li=1,hi=2*n-1;
    for(int i=0;i<n;i++) scanf("%d",&inp[i]);
    printf("%d ",inp[0]),used[inp[0]]=true;
    for(int i=1;i<n;i++) {
        if(inp[i-1]>=inp[i]) {
            while(used[li]) li++;
            printf("%d ",li),used[li]=true;
        }
        if(inp[i-1]<=inp[i]) {
            while(used[hi]) hi--;
            printf("%d ",hi),used[hi]=true;
        }
        if(inp[i-1]!=inp[i])
            printf("%d ",inp[i]),used[inp[i]]=true;
    }
}

Compilation message

medians.cpp: In function 'int main()':
medians.cpp:6:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
medians.cpp:8:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++) scanf("%d",&inp[i]);
                                             ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2600 KB Not a permutation
2 Incorrect 0 ms 2600 KB Not a permutation
3 Incorrect 0 ms 2600 KB Not a permutation
4 Incorrect 0 ms 2600 KB Not a permutation
5 Incorrect 0 ms 2600 KB Not a permutation
6 Correct 0 ms 2600 KB Output is correct
7 Incorrect 0 ms 2600 KB Not a permutation
8 Incorrect 0 ms 2600 KB Not a permutation
9 Incorrect 0 ms 2600 KB Not a permutation
10 Incorrect 0 ms 2600 KB Not a permutation
11 Incorrect 0 ms 2600 KB Not a permutation
12 Incorrect 0 ms 2600 KB Not a permutation
13 Incorrect 0 ms 2600 KB Not a permutation
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2600 KB Not a permutation
2 Incorrect 0 ms 2600 KB Not a permutation
3 Incorrect 0 ms 2600 KB Not a permutation
4 Incorrect 3 ms 2600 KB Not a permutation
5 Incorrect 9 ms 2600 KB Not a permutation
6 Incorrect 26 ms 2600 KB Not a permutation
7 Incorrect 33 ms 2600 KB Not a permutation