답안 #338959

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
338959 2020-12-24T10:29:42 Z MilosMilutinovic 중앙값 배열 (balkan11_medians) C++14
5 / 100
135 ms 12908 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN=1e5;
int n, a[mxN], ans[mxN*2];
set<int> b;

int main() {
	cin >> n;
	for(int i=1; i<2*n; ++i)	
		b.insert(i);
	for(int i=0; i<n; ++i)
		cin >> a[i], b.erase(a[i]);
	for(int i=0; i<n; ++i)
		if(i==0||a[i]!=a[i-1])
			ans[2*i]=a[i];
	for(int i=0; i<2*n-1; ++i) {
		if(ans[i]>0)
			continue;
		if(i%2==0)
			ans[i]=*b.begin(), b.erase(b.begin());
		else {
			auto it=b.end();
			--it;
			ans[i]=*it, b.erase(it);
		}
	}	
	for(int i=0; i<2*n-1; ++i)
		cout << ans[i] << " ";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Not a permutation
2 Incorrect 1 ms 364 KB Not a permutation
3 Incorrect 1 ms 364 KB Not a permutation
4 Incorrect 1 ms 364 KB Not a permutation
5 Incorrect 1 ms 364 KB Not a permutation
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Not a permutation
8 Incorrect 1 ms 364 KB Not a permutation
9 Incorrect 1 ms 364 KB Not a permutation
10 Incorrect 1 ms 364 KB Not a permutation
11 Incorrect 1 ms 364 KB Not a permutation
12 Incorrect 1 ms 364 KB Not a permutation
13 Incorrect 2 ms 396 KB Not a permutation
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 620 KB Not a permutation
2 Incorrect 4 ms 876 KB Not a permutation
3 Incorrect 9 ms 1260 KB Not a permutation
4 Incorrect 18 ms 2284 KB Not a permutation
5 Incorrect 35 ms 4332 KB Not a permutation
6 Incorrect 74 ms 8428 KB Not a permutation
7 Incorrect 135 ms 12908 KB Not a permutation