Submission #611702

# Submission time Handle Problem Language Result Execution time Memory
611702 2022-07-29T06:44:48 Z PiejanVDC Shortcut (IOI16_shortcut) C++17
0 / 100
0 ms 212 KB
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
 
long long find_shortcut(int n, vector<int>l, vector<int>d, int c) {
    long long le[n], re[n], lee[n], ree[n];
    le[0] = lee[0] = ree[n-1] = 0;
    re[n-1] = d[n-1];
    for(int i = 1 ; i < n ; i++) {
        le[i] = max(le[i-1]+(long long)l[i-1], (long long)d[i]), lee[i] = le[i-1]+l[i-1];
    }
    for(int j = n-2 ; j >= 0 ; j--) {
        re[j] = max(re[j+1] + (long long)l[j], (long long)d[j]), ree[j] = re[j+1] + l[j];
    }

    long long mn = (long long)1e18;

    for(int i = 0 ; i < n ; i++) {
        for(int j = i+1 ; j < n ; j++) {
            long long x = 0;
            for(int k = i+1 ; k < j ; k++) {
                //cout << i << ' ' << j << '\n';
                x = max(x, lee[k]+d[k]);
                x = max(x, ree[k]+d[k]);
                //cout << le[i] << ' ' << re[j] << '\n'; 
                x = max(x, le[i]+re[j]+c);
                mn = min(mn, x);
            }
        }
    }
    return mn;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 70
3 Halted 0 ms 0 KB -