#include <bits/stdc++.h>
#include "shortcut.h"
using namespace std;
#define ll long long
const int N = 1e5+5;
ll pref[N], suff[N];
ll find_shortcut(int n, vector<int> l, vector<int> d, int c){
for (int i = 0; i < n; i++){
ll sum = 0;
pref[i] = suff[i] = d[i];
for (int j = i-1; j >= 0; j--){
sum += l[j];
pref[i] = max(pref[i], sum+d[j]);
}
sum = l[i];
for (int j = i+1; j < n; j++){
suff[i] = max(suff[i], sum+d[j]);
if (j == n-1) break;
sum += l[j];
}
}
ll mn = 1e18;
for (int i = 0; i < n; i++){
for (int j = i+1; j < n; j++){
mn = min(mn, pref[i]+suff[j]+c);
}
}
return mn;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
n = 4, incorrect answer: jury 80 vs contestant 40 |
2 |
Halted |
0 ms |
0 KB |
- |