답안 #153161

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153161 2019-09-12T15:53:36 Z tushar_2658 중앙값 배열 (balkan11_medians) C++14
0 / 100
34 ms 3448 KB
#include "bits/stdc++.h"
using namespace std;

const int maxn = 2e5 + 5; 
int b[maxn], a[maxn];

int main(int argc, char const *argv[])
{
 //   freopen("in.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    int maxi = -1;
    for(int i = 1; i <= n; i++){
        scanf("%d", &b[i]);
        if(b[i] > maxi)maxi = b[i];
    }
    for(int i = 1; i <= n; i++){
        a[2*i-1] = b[i];
    }
    for(int i = 1; i <= 2*n-1; i++){
        if(!a[i])a[i] = maxi + 1; 
    }
    for(int i = 1; i <= 2*n-1; i++)printf("%d ", a[i]);

    return 0;
}

Compilation message

medians.cpp: In function 'int main(int, const char**)':
medians.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
medians.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &b[i]);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 504 KB Not a permutation
2 Incorrect 3 ms 256 KB Integer 40 violates the range [1, 39]
3 Incorrect 2 ms 256 KB Not a permutation
4 Incorrect 2 ms 256 KB Not a permutation
5 Incorrect 3 ms 380 KB Not a permutation
6 Incorrect 3 ms 504 KB Integer 120 violates the range [1, 119]
7 Incorrect 2 ms 376 KB Not a permutation
8 Incorrect 2 ms 376 KB Not a permutation
9 Incorrect 2 ms 376 KB Not a permutation
10 Incorrect 2 ms 376 KB Not a permutation
11 Incorrect 2 ms 380 KB Not a permutation
12 Incorrect 2 ms 376 KB Not a permutation
13 Incorrect 3 ms 376 KB Not a permutation
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 504 KB Not a permutation
2 Incorrect 3 ms 504 KB Not a permutation
3 Incorrect 5 ms 536 KB Not a permutation
4 Incorrect 7 ms 760 KB Not a permutation
5 Incorrect 12 ms 1272 KB Not a permutation
6 Incorrect 23 ms 2296 KB Not a permutation
7 Incorrect 34 ms 3448 KB Not a permutation