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 <iostream>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl
#define MAX 200000
lli n,res,paso,a;
lli ori[MAX+2],A[MAX+2],B[MAX+2];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
rep(i,1,n+1) {
cin >> A[i];
ori[i] = A[i];
}
rep(i,1,n) cin >> B[i];
sort(A+1, A+n+2);
sort(B+1, B+n+1);
rep(i,1,n+1) {
paso = 0;
res = 0;
rep(j,1,n) {
if (paso==0 && ori[i] == A[j]) {
paso=1;
continue;
}
a = A[j] - B[j-paso];
if (a > res) res = a;
}
cout << res << ' ';
}
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... |