#include <bits/stdc++.h>
using namespace std;
int nbTypes;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> nbTypes;
vector<int> a(nbTypes + 1);
for (int iT = 0; iT <= nbTypes; iT ++)
cin >> a[iT];
vector<int> b(nbTypes);
for (int jT = 0; jT < nbTypes; jT ++)
cin >> b[jT];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
vector<int> c(nbTypes + 1);
vector<int> d(nbTypes + 1);
for (int iT = 0; iT < nbTypes; iT ++) {
c[iT] = a[iT] - b[iT];
d[iT + 1] = a[iT + 1] - b[iT];
}
for (int iT = 1; iT <= nbTypes; iT ++)
c[iT] = max(c[iT], c[iT - 1]);
for (int jT = nbTypes - 1; jT >= 0; jT --)
d[jT] = max(d[jT + 1], d[jT]);
for (int i = 0; i <= nbTypes; i ++) {
int mu = i == 0 ? 0 : c[i - 1];
int nu = i == nbTypes ? 0 : d[i + 1];
cout << max(mu, nu);
if (i != nbTypes) cout << " ";
}
}
# |
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 |
- |