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 "shortcut.h"
#include <algorithm>
using namespace std;
typedef long long int ll;
int N;
ll C;
ll L[3005];
ll D[3005];
ll ans=1e18,res;
long long find_shortcut(int N, std::vector<int> l, std::vector<int> d, int C)
{
for(int i=1;i<N;i++)
L[i]=L[i-1]+l[i-1];
for(int i=0;i<N;i++)
D[i]=d[i];
for(int i=0;i<N;i++)
for(int j=i+1;j<N;j++){
res=0;
for(int x=0;x<N;x++)
for(int y=x+1;y<N;y++)
res=max(res,min(L[y]-L[x],abs(L[x]-L[i])+abs(L[y]-L[j])+C)+D[x]+D[y]);
ans=min(ans,res);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |