#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n,a;
cin >> n;
vector<long long> ans(n+1);
vector<pair<long long,long long>> haha(n+1);
vector<long long> bruh(n);
for(long long i = 0; i <= n; i++) {
cin >> a;
haha[i] = {a,i};
}
for(long long i = 0; i < n; i++) {
cin >> bruh[i];
}
sort(haha.begin(),haha.end());
sort(bruh.begin(),bruh.end());
vector<long long> pr(n+1);
vector<long long> su(n+1);
for(long long i = 1; i <= n; i++) {
pr[i] = abs(haha[i-1].first-bruh[i-1]);
pr[i] = max(pr[i],pr[i-1]);
}
for(long long i = n-1; i >= 0; i--) {
su[i] = abs(haha[i+1].first-bruh[i]);
su[i] = max(su[i],su[i+1]);
}
for(long long i = 0; i < n+1; i++) {
ans[i] = max(pr[i],su[i]);
}
for(long long i = 0; i < n+1; i++) {
cout << ans[i] << " ";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |