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"
typedef long long ll;
using namespace std;
ll arr[1001][1001];
long long find_shortcut(int n, vector<int> l, vector<int> d, int c) {
ll best = 999999999999999999;
for(int i = 0; i < n; i++) {
for(int j = i+1; j < n; j++) {
if(j - i == 1) arr[i][j] = arr[j][i] = l[i];
else arr[i][j] = arr[j][i] = arr[i][j-1] + l[j-1];
}
}
for(int le = 0; le < n; le++) {
for(int ri = le+1; ri < n; ri++) {
ll biggest = -1;
for(int i = 0; i < n; i++) {
for(int j = i+1; j < n; j++) {
biggest = max(biggest, d[i] + d[j] + min(arr[i][j], arr[i][le] + c + arr[ri][j]));
}
}
best = min(biggest, best);
}
}
return best;
}
# | 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... |