Submission #786836

# Submission time Handle Problem Language Result Execution time Memory
786836 2023-07-18T13:28:38 Z mindiyak Shortcut (IOI16_shortcut) C++14
0 / 100
1 ms 300 KB
#include "shortcut.h"
#include <iostream>
#include <algorithm>

using namespace std;

long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c)
{
    vector<int>S(n,0);
    for(int i=0;i<n-1;i++){
        S[i+1] = S[i] + l[i];
    }
    vector<int>depth(n,0);
    vector<int>start(n,0);
    vector<pair<int,pair<int,int>>> diameters;

    depth[0] = d[0];
    for(int i=1;i<n;i++){
        depth[i] = max(l[i-1]+depth[i-1],d[i]);
        if(S[i] < d[i]){
            start[i] = i;
        }
        else{
            start[i] = start[i-1];
        }
        
        diameters.push_back({l[i-1]+depth[i-1]+d[i],{start[i-1],i}});
    }

    sort(diameters.rbegin(),diameters.rend());

    int max_diameter = diameters[0].first;

    max_diameter = min(diameters[0].first - (S[diameters[0].second.second] - S[diameters[0].second.first]) + c,max_diameter);

    max_diameter = max(max_diameter,diameters[1].first);

    return max_diameter;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 1 ms 212 KB n = 4, 21 is a correct answer
4 Correct 1 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 1 ms 212 KB n = 2, 3 is a correct answer
7 Correct 1 ms 300 KB n = 3, 29 is a correct answer
8 Correct 1 ms 296 KB n = 2, 3 is a correct answer
9 Correct 1 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 1 ms 300 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -