# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234559 | nicolaalexandra | Just Long Neckties (JOI20_ho_t1) | C++14 | 302 ms | 10872 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 DIM 200010
using namespace std;
pair <int,int> a[DIM];
int b[DIM],dp_left[DIM],dp_right[DIM],sol[DIM];
int n,i;
int main (){
//ifstream cin ("date.in");
//ofstream cout ("date.out");
cin>>n;
for (i=1;i<=n+1;i++){
cin>>a[i].first;
a[i].second = i;
}
for (i=1;i<=n;i++)
cin>>b[i];
sort (a+1,a+n+2);
sort (b+1,b+n+1);
dp_left[1] = 0;
for (i=1;i<=n;i++)
dp_left[i+1] = max (dp_left[i],a[i].first - b[i]);
dp_right[n+1] = 0;
for (i=n;i;i--)
dp_right[i] = max (dp_right[i+1], a[i+1].first - b[i]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |