| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 30895 | Navick | medians (balkan11_medians) | C++14 | 129 ms | 12956 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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(){
int n; scanf("%d", &n);
for(int i=1; i<2*n; i++)
st.insert(i);
for(int i=0; i<n; i++){
scanf("%d", a + i);
if(i == 0){
printf("%d ", a[i]);
st.erase(a[i]);
}
else{
if(st.find(a[i]) != st.end()){
if(a[i] > a[i - 1]){
printf("%d ", a[i]);
st.erase(a[i]);
printf("%d ", *(st.rbegin()));
st.erase(*st.rbegin());
}else if(a[i] < a[i - 1]){
printf("%d ", a[i]);
st.erase(a[i]);
printf("%d ", *(st.begin()));
st.erase(st.begin());
}
}
else{
if(a[i] == a[i - 1]){
printf("%d ", *st.begin());
st.erase(st.begin());
printf("%d ", *(st.rbegin()));
st.erase(*st.rbegin());
}else if(a[i] < a[i - 1]){
printf("%d ", *st.begin());
st.erase(st.begin());
printf("%d ", *st.begin());
st.erase(st.begin());
}else{
printf("%d ", *st.rbegin());
st.erase(*st.rbegin());
printf("%d ", *st.rbegin());
st.erase(*st.rbegin());
}
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
