#include <iostream>
#include <algorithm>
#define f first
#define s second
using namespace std;
long long n, b[200010], maxx[200010], maxxx, ans[200010];
pair<int,int> a[200010];
int main() {
cin >> n;
for (int i = 1; i <= n+1; i++) {
cin >> a[i].f;
a[i].s = i;
}
for (int i = 1; i <= n; i++) cin >> b[i];
sort(a+1,a+n+2);
sort(b+1,b+n+1);
for (int i = n; i >= 1; i--) maxx[i] = max(maxx[i+1],abs(a[i+1].f-b[i]));
for (int i = 1; i <= n+1; i++) {
ans[a[i].s] = max(maxxx,maxx[i]);
maxxx = max(maxxx,abs(a[i].f-b[i]));
}
for (int i = 1; i <= n+1; i++) cout << ans[i] << " ";
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |