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);
int n, c;
cin >> n;
vector<pair<int, int>> a;
vector<int> b;
for (int i=0; i<n+1; i++){
cin >> c;
a.push_back({c, i});
}
for (int i=0; i<n; i++){
cin >> c;
b.push_back(c);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
int wyn, ind_b;
for (int us=0; us<=n; us++){
wyn = 0;
ind_b = n-1;
for (int ind_a=n; ind_a>=0; ind_a--){
if (a[ind_a].second==us) continue;
wyn = max(wyn, a[ind_a].first-b[ind_b]);
ind_b--;
}
cout << wyn << " ";
}
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... |