This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
ll x[500];
ll dist(int v,int u){
if(u<v) swap(u,v);
return x[u]-x[v];
}
ll find_shortcut(int n,vector<int> l,vector<int> d,int c){
ll o,r,s;
x[0]=d[0];
for(int i=0;i<n-1;i++)
x[i+1]=x[i]+l[i];
o=1e18;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int p=r=0;p<n;p++){
for(int q=p+1;q<n;q++){
s=min(dist(p,i)+dist(q,j),dist(p,j)+dist(q,i))+c;
s=min(s,dist(p,q));
r=max(r,s+d[p]+d[q]);
}
}
o=min(o,r);
}
}
return o;
}
# | 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... |