#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
vector <int> a(n+1),b(n);
for(int i=0;i<=n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++)cin>>b[i];
sort(all(b));
for(int i=0;i<=n;i++){
multiset <int> ms;
for(int j=0;j<=n;j++){
if(j!=i)ms.insert(a[j]);
}
//for(auto x : ms)cout<<x<<" ";
//cout<<"\n";
int mx=0;
for(int j=0;j<n;j++){
auto it=ms.upper_bound(b[j]);
if(it==ms.begin())mx=max(mx,*it-b[j]);
if(it==ms.end())it--;
ms.erase(it);
}
cout<<mx<<" ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |