#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int>a(n+1), b(n);
vector<int>ans(n);
for (auto &i : a) cin >> i;
for (auto &i : b) cin >> i;
sort(a.begin(), a.end());
sort(b.begin(), b.end());
for (int i = 0 ; i < n ; i++) {
ans[i] = max(a[i+1] - b[i], 0);
}
for (int i = 0 ; i < n+1 ; i++) {
cout << *max_element(ans.begin(), ans.end()) << " ";
if (i == n) break;
ans[i] = max(a[i] - b[i], 0);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |