# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
224014 | tqbfjotld | Just Long Neckties (JOI20_ho_t1) | C++14 | 135 ms | 8292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int ans[200005];
vector<pair<int,int> > a;
vector<int> b;
int n;
int pre[200005];
int suf[200005];
int main(){
scanf("%d",&n);
for (int x = 0; x<n+1; x++){
int c;
scanf("%d",&c);
a.push_back({c,x});
}
for (int x = 0; x<n; x++){
int c;
scanf("%d",&c);
b.push_back(c);
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
int t = 0;
for (int x = 0; x<n; x++){
t = max(t,a[x].first-b[x]);
pre[x] = t;
}
t = 0;
for (int x = n-1; x>=0; x--){
t = max(t,a[x+1].first-b[x]);
suf[x] = t;
}
for (int x = 0; x<=n; x++){
if (x==0) ans[a[x].second] = suf[0];
else if (x==n) ans[a[x].second] = pre[x-1];
else
ans[a[x].second] = max(pre[x-1],suf[x]);
}
for (int x = 0; x<=n; x++){
printf("%d ",ans[x]);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |