#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
deque<int> a,b,aux;
for(int i=0;i<n+1;i++){
int x;
cin>>x;
aux.push_back(x);
}
for(int i=0;i<n;i++){
int x;
cin>>x;
a.push_back(x);
}
stable_sort(a.begin(),a.end());
int ans=0;
for(int i=0;i<n;i++){
swap(aux[i],aux[n]);
for(int j=0;j<n;j++){
b.push_back(aux[j]);
}
stable_sort(b.begin(),b.end());
for(int j=0;j<n;j++){
ans=max(ans,abs(b[j]-a[j]));
}
swap(aux[i],aux[n]);
b.clear();
cout<<ans<<' ';
ans=0;
}
aux.pop_back();
stable_sort(aux.begin(),aux.end());
ans=0;
for(int i=0;i<n;i++){
ans=max(ans,abs(b[i]-a[i]));
}
cout<<ans<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |