제출 #153161

#제출 시각아이디문제언어결과실행 시간메모리
153161tushar_2658중앙값 배열 (balkan11_medians)C++14
0 / 100
34 ms3448 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...