답안 #746299

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
746299 2023-05-22T08:59:47 Z teo_thrash 중앙값 배열 (balkan11_medians) C++14
5 / 100
27 ms 3064 KB
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int maxn=1e6+3;
const int mod=1e9+7;

int n;
int b[maxn];
vector<int> a;
bool used[maxn];
ll nm=0, ng;

int nai_malko(){
    while(used[nm]){
        nm++;
    }
    used[nm]=true;

    return nm;
}

int nai_golqmo(){
    while(used[ng]){
        ng--;
    }
    used[ng]=true;

    return ng;
}

int main(){

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

cin>>n;

for(int i=0; i<=2*n+1; i++){
    used[i]=false;
}

ng=2*n;
used[nm]=used[ng]=true;


for(int i=1; i<=n; i++){
    cin>>b[i];
}

a.pb(b[1]);

used[b[1]]=true;

for(int i=2; i<=n; i++){

    used[b[i]]=true;
    if(b[i-1]==b[i]){
        int x=nai_malko();
        int y=nai_golqmo();

        a.pb(x);
        a.pb(y);
    }

    if(b[i]>b[i-1]){
        int seg=nai_golqmo();

        a.pb(b[i]);
        a.pb(seg);
    }

    if(b[i]<b[i-1]){
        int seg=nai_malko();

        a.pb(b[i]);
        a.pb(seg);
    }
}

for(int i: a){
    cout<<i<<" ";
}

return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Not a permutation
2 Incorrect 1 ms 212 KB Not a permutation
3 Incorrect 0 ms 212 KB Not a permutation
4 Incorrect 1 ms 212 KB Not a permutation
5 Incorrect 1 ms 212 KB Not a permutation
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 1 ms 212 KB Not a permutation
8 Incorrect 0 ms 212 KB Not a permutation
9 Incorrect 0 ms 212 KB Not a permutation
10 Incorrect 1 ms 340 KB Not a permutation
11 Incorrect 1 ms 340 KB Not a permutation
12 Incorrect 1 ms 340 KB Not a permutation
13 Incorrect 1 ms 340 KB Not a permutation
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Not a permutation
2 Incorrect 2 ms 468 KB Not a permutation
3 Incorrect 3 ms 596 KB Not a permutation
4 Incorrect 5 ms 852 KB Not a permutation
5 Incorrect 10 ms 1368 KB Not a permutation
6 Incorrect 19 ms 2100 KB Not a permutation
7 Incorrect 27 ms 3064 KB Not a permutation