#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> t1(n + 1);
vector<int> t2(n);
vector<int> p;
vector<int> t;
for(int i = 0; i < n + 1; i++) {
cin >> t1[i];
}
for (int i = 0; i < n; i++) {
cin >> t2[i];
}
sort(t1.begin(), t1.end());
sort(t2.begin(), t2.end());
int m = 0;
for (int i = 0; i < n; i++) {
if (t1[i] - t2[i] > m) {
m = t1[i] - t2[i];
}
p.push_back(m);
}
m = 0;
for (int i = n; i > 0; i--) {
if (t1[i] - t2[i - 1] > m) {
m = t1[i] - t2[i - 1];
}
t.push_back(m);
}
reverse(t.begin(), t.end());
cout << t[0] << " ";
for (int i = 0; i < n - 1; i++) {
cout << max(p[i], t[i + 1]) << " ";
}
cout << p[p.size() - 1];
}
# |
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 |
- |