Submission #404677

# Submission time Handle Problem Language Result Execution time Memory
404677 2021-05-14T19:54:45 Z MDario Shortcut (IOI16_shortcut) C++11
Compilation error
0 ms 0 KB
#include "shortcut.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
long long find_shortcut(int n, vector<ll> l, vector<ll> d, ll c){
    ll p[n], a[n], a1[n], r=1000000000000000000ll;
    p[0]=0;
    for(int i=0; i<n-1; i++){
        p[i+1]=p[i]+l[i];
    }
    a[0]=d[0];
    for(int i=1; i<n; i++){
        a[i]=max(a[i-1]+l[i-1], d[i]);
    }
    a1[n-1]=d[n-1];
    for(int i=n-2; i>=0; i--){
        a1[i]=max(a1[i+1]+l[i], d[i]);
    }
    ll r1=0;
    for(int i=0; i<n; i++){
        for(int t=i; t<n; t++){
            r1=min(a[i]+a1[t]+p[t]-p[i], a[i]+a1[t]+c);
            for(int e=i; e<=t; e++){
                r1=max(r1, max(min(a[i]+p[e]-p[i], a[i]+p[t]-p[e]+c), min(a[t]+p[t]-p[e], a[t]+p[e]-p[i]+c)));
            }
            r=min(r, r1);
        }
    }
    return r;
}

Compilation message

/usr/bin/ld: /tmp/ccXAphvk.o: in function `main':
grader.cpp:(.text.startup+0x124): undefined reference to `find_shortcut(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, int)'
collect2: error: ld returned 1 exit status