# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
203108 | ZwariowanyMarcin | Just Long Neckties (JOI20_ho_t1) | C++14 | 5 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
using namespace std;
const int nax = 2e5 + 111;
int n;
pair<int,int> a[nax];
int b[nax];
int s[nax][2];
int ans[nax];
int main() {
scanf ("%d", &n);
rep(i, 1, n + 1) {
scanf ("%d", &a[i].fi);
a[i].se = i;
}
rep(i, 1, n) scanf ("%d", b + i);
sort(b + 1, b + n + 1);
sort(a + 1, a + n + 2);
rep(i, 1, n) {
s[i][0] = abs(b[i] - a[i].fi);
s[i][1] = abs(b[i] - a[i + 1].fi);
}
rep(i, 1, n) s[i][0] = max(s[i][0], s[i - 1][0]);
per(i, 1, n) s[i][1] = max(s[i][1], s[i + 1][1]);
rep(i, 1, n + 1) {
// printf ("%d %d %d\n", i, s[i - 1][0], s[i][1]);
int x = (i > 0 ? s[i - 1][0] : 0);
x = max(x, s[i][1]);
ans[a[i].se] = x;
}
rep(i, 1, n + 1) printf ("%d ", ans[i]);
return 0;
}
컴파일 시 표준 에러 (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... |