This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,k,odd,index;
cin >> n;
vector<pair<int,int>>dostepne_szyje;
vector<int>jakie_maja_ludzie;
for(int i=0;i<n+1;++i){
cin >> k;
dostepne_szyje.push_back({k,i+1});
}
sort(dostepne_szyje.begin(),dostepne_szyje.end());
for(int i=0;i<n;++i){
cin >> k;
jakie_maja_ludzie.push_back(k);
}
sort(jakie_maja_ludzie.begin(),jakie_maja_ludzie.end());
for(int i=1;i<n+2;++i){
odd=0;
index=0;
for(int j=0;j<n+1;++j){
if(dostepne_szyje[j].second==i) continue;
odd=max(odd,dostepne_szyje[j].first-jakie_maja_ludzie[index]);
index++;
}
cout << odd << ' ';
}
cout << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |