# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
202448 | Kastanda | Just Long Neckties (JOI20_ho_t1) | C++11 | 142 ms | 7112 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// In The Name Of The Queen
#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 200005;
int n, B[N], P[N], S[N], R[N];
pair < int , int > A[N];
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n + 1; i ++)
scanf("%d", &A[i].x), A[i].y = i;
for (int i = 1; i <= n; i ++)
scanf("%d", &B[i]);
sort(A + 1, A + n + 2);
sort(B + 1, B + n + 1);
for (int i = 1; i <= n; i ++)
P[i] = max(P[i - 1], A[i].x - B[i]);
for (int i = n; i; i --)
S[i] = max(S[i + 1], A[i + 1].x - B[i]);
for (int i = 1; i <= n + 1; i ++)
R[A[i].y] = max(P[i - 1], S[i]);
for (int i = 1; i <= n + 1; i ++)
printf("%d ", R[i]);
return 0;
}
Compilation message (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... |