#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());
for (int i = 0; i < n+1; i++) {
int mx = 0;
bool skipped = false;
for (int j = 0, id = 0; j < n+1; j++) {
if (!skipped && a[i] == a2[j]) {
skipped = true;
continue;
}
mx = max(mx, abs(a2[j] - b[id]));
id++;
}
cout << mx << ' ';
}
cout << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |