# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789463 | Acanikolic | Just Long Neckties (JOI20_ho_t1) | C++14 | 1065 ms | 10696 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>
#define ll long long
#define int long long
#define pb push_back
#define F first
#define S second
using namespace std;
const long long N = 2e5+10;
const long long mod = 1e9+7;
const long long inf = 1e18;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<int>a(n+2),b(n+1);
for(int i=1;i<=n+1;i++) cin >> a[i];
for(int i=1;i<=n;i++) cin >> b[i];
sort(b.begin()+1,b.end());
for(int i=1;i<=n+1;i++) {
int res = 0,ptr = 1;
vector<int>V;
V.pb(0);
for(int j=1;j<i;j++) V.pb(a[j]);
for(int j=i+1;j<=n+1;j++) V.pb(a[j]);
sort(V.begin()+1,V.end());
for(int j=1;j<=n;j++) res = max(res,max(0ll,V[j]-b[j]));
cout << res << ' ';
}
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... |