#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long LL;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
vector<LL> A(N + 1), B(N);
for (int i = 0; i <= N; i++) {
cin >> A[i];
}
for (int i = 0; i < N; i++) {
cin >> B[i];
}
sort(A.begin(), A.end());
sort(B.begin(), B.end());
multiset<LL> vals;
for (int i = 0; i < N; i++) {
// After - Before;
vals.insert(max(A[i + 1] - B[i], 0LL));
}
for (int i = 0; i <= N; i++) {
if (i) {
vals.erase(vals.find(max(A[i] - B[i - 1], 0LL)));
vals.insert(max(A[i - 1] - B[i - 1], 0LL));
}
if (i) cout << ' ';
cout << *vals.rbegin();
}
cout << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |