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;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<pair<int, int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long
#define mod 1000000007
ofstream fout(".out");
ifstream fin(".in");
signed main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n + 1], b[n];
for(int i = 0; i < n + 1; i++)
cin >> a[i];
for(int i = 0; i < n; i++)
cin >> b[i];
sort(a, a + n + 1);
sort(b, b + n);
for(int i = 0; i < n + 1; i++) {
int x = 0, j = 0, k = 0;
while(j < n) {
if(k == i) {
k++;
continue;
}
x = max(x, a[k] - b[j]);
j++;
k++;
}
cout << x << " ";
}
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... |