답안 #480735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
480735 2021-10-18T02:05:41 Z socpite 중앙값 배열 (balkan11_medians) C++14
5 / 100
207 ms 1484 KB
#include<bits/stdc++.h>
using namespace std;

int currmin, currmax, pre, n, tmp;
vector<bool> used;

int getmin(){
    while(used[currmin])currmin++;
    return currmin;
}

int getmax(){
    while(used[currmax])currmax--;
    return currmax;
}

void query(int x){
    cout << x << " ";
    used[x]=true;
}

int main(){
    cin >> n;
    used.assign(2*n, false);
    currmin = 1;
    currmax = 2*n-1;
    cin >> tmp;
    cout << tmp << " ";
    used[tmp]=true;
    pre = tmp;
    for(int i = 0; i < n-1; i++){
        cin >> tmp;
        if(tmp > pre){
            query(tmp);
            query(getmax());
        }
        else if(tmp < pre){
            query(tmp);
            query(getmin());
        }
        else{
            query(getmin());
            query(getmax());
        }
        pre = tmp;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Not a permutation
2 Incorrect 0 ms 204 KB Not a permutation
3 Incorrect 0 ms 204 KB Not a permutation
4 Incorrect 0 ms 204 KB Not a permutation
5 Incorrect 2 ms 204 KB Not a permutation
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Not a permutation
8 Incorrect 1 ms 204 KB Not a permutation
9 Incorrect 1 ms 204 KB Not a permutation
10 Incorrect 1 ms 204 KB Not a permutation
11 Incorrect 1 ms 204 KB Not a permutation
12 Incorrect 2 ms 204 KB Not a permutation
13 Incorrect 3 ms 204 KB Not a permutation
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 312 KB Not a permutation
2 Incorrect 9 ms 332 KB Not a permutation
3 Incorrect 20 ms 348 KB Not a permutation
4 Incorrect 33 ms 448 KB Not a permutation
5 Incorrect 61 ms 588 KB Not a permutation
6 Incorrect 122 ms 956 KB Not a permutation
7 Incorrect 207 ms 1484 KB Not a permutation