답안 #30893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
30893 2017-07-31T12:40:33 Z Navick 중앙값 배열 (balkan11_medians) C++14
5 / 100
96 ms 13116 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pii pair<int, int>
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 2e5 + 10;

set<int> st;

int a[N], b[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	for(int i=1; i<2*n; i++)
		st.insert(i);

	for(int i=0; i<n; i++){
		cin >> a[i];
		if(i == 0){
			b[i] = a[i];
			st.erase(a[i]);
		}
		else{
			if(a[i] > a[i - 1]){
				b[2*i] = a[i];
				st.erase(a[i]);
				b[2*i - 1] = *(st.rbegin());
				st.erase(*st.rbegin());
			}else if(a[i] < a[i - 1]){
				b[2*i] = a[i];
				st.erase(a[i]);
				b[2*i - 1] = *(st.begin());
				st.erase(st.begin());
			}else{
				b[2*i] = *(st.rbegin());
				st.erase(*st.rbegin());
				b[2*i - 1] = *(st.begin());
				st.erase(st.begin());
			}
		}
	}
	for(int i=0; i<2*n - 1; i++)
		cout << b[i] << ' '; cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3744 KB Not a permutation
2 Incorrect 0 ms 3744 KB Not a permutation
3 Incorrect 0 ms 3744 KB Not a permutation
4 Incorrect 0 ms 3744 KB Not a permutation
5 Incorrect 0 ms 3744 KB Not a permutation
6 Correct 0 ms 3744 KB Output is correct
7 Incorrect 0 ms 3744 KB Not a permutation
8 Incorrect 0 ms 3744 KB Not a permutation
9 Incorrect 0 ms 3744 KB Not a permutation
10 Incorrect 0 ms 3744 KB Not a permutation
11 Incorrect 0 ms 3744 KB Not a permutation
12 Incorrect 0 ms 3744 KB Not a permutation
13 Runtime error 0 ms 3744 KB Execution killed because of forbidden syscall writev (20)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 3876 KB Execution killed because of forbidden syscall writev (20)
2 Runtime error 0 ms 4140 KB Execution killed because of forbidden syscall writev (20)
3 Runtime error 3 ms 4404 KB Execution killed because of forbidden syscall writev (20)
4 Runtime error 13 ms 5196 KB Execution killed because of forbidden syscall writev (20)
5 Runtime error 26 ms 6648 KB Execution killed because of forbidden syscall writev (20)
6 Runtime error 43 ms 9684 KB Execution killed because of forbidden syscall writev (20)
7 Runtime error 96 ms 13116 KB Execution killed because of forbidden syscall writev (20)