# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
103039 | rzbt | 중앙값 배열 (balkan11_medians) | C++14 | 35 ms | 2424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define MAXN 200005
using namespace std;
int n,q;
bool dodat[MAXN];
int prvi=1,poslednji,prosli;
void dp(){
while(dodat[prvi])prvi++;
dodat[prvi]=true;
printf("%d ",prvi);
}
void dk(){
while(dodat[poslednji])poslednji--;
dodat[poslednji]=true;
printf("%d ",poslednji);
}
int main()
{
int n;
scanf("%d", &n);
poslednji=n+n-1;
scanf("%d",&prosli);
dodat[prosli]=true;
printf("%d ",prosli);
for(int i=2;i<=n;i++){
int t;
scanf("%d", &t);
if(t==prosli){
dp();
dk();
}else if(prosli<t){
if(dodat[t])dk();
else{
dodat[t]=true;
printf("%d ",t);
}
dk();
}else{
if(dodat[t])dp();
else{
dodat[t]=true;
printf("%d ",t);
}
dp();
}
prosli=t;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |