#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
const int maxn = 2e5 + 5;
int n;
int a[maxn], b[maxn], p[maxn], s[maxn];
int main(int argc, char const *argv[])
{
#ifdef LOCAL
freopen("in", "r", stdin);
#endif
cin >> n;
for(int i = 1; i <= n+1; i++) {
cin >> a[i];
}
for(int i = 1; i <= n; i++) {
cin >> b[i];
}
sort(a + 1, a + 2 + n);
sort(b + 1, b + 1 + n);
for(int i = n+1; i > 1; i--) {
s[i] = max(s[i+1], a[i] - b[i-1]);
}
for(int i = 1; i <= n; i++) {
p[i] = max(p[i-1], a[i] - b[i]);
}
for(int i = 1; i <= n+1; i++) {
cout << max(p[i-1], s[i+1]) << ' ';
} cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |