# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
212502 | DystoriaX | Just Long Neckties (JOI20_ho_t1) | C++14 | 1082 ms | 6640 KiB |
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 n;
int a[200010], b[200010];
vector<int> c;
int ans[200010];
int main(){
scanf("%d", &n);
for(int i = 1; i <= n + 1; i++) scanf("%d", &a[i]);
for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
sort(b + 1, b + n + 1);
for(int i = 1; i <= n + 1; i++){
c.clear();
for(int j = 1; j <= n + 1; j++){
if(i == j) continue;
c.emplace_back(a[j]);
}
sort(c.begin(), c.end());
for(int j = 0; j < (int) c.size(); j++){
ans[i] = max(ans[i], c[j] - b[j + 1]);
}
}
for(int i = 1; i <= n + 1; i++){
printf("%d ", ans[i]);
}
printf("\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |