#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector <int> a(n+1), b(n);
for (int i = 0; i < n+1; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
cin >> b[i];
sort(b.begin(), b.end());
vector <int> a2 = a;
sort(a2.begin(), a2.end());
multiset <int> d;
for (int i = 1; i < n+1; i++) {
d.insert(max(0, a2[i] - b[i-1]));
}
cout << *d.rbegin() << ' ';
for (int i = 0; i < n; i++) {
d.insert(max(0, a2[i] - b[i]));
d.erase(d.find(max(0, a2[i+1] - b[i])));
cout << *d.rbegin() << ' ';
}
cout << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |