답안 #932315

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
932315 2024-02-23T07:58:10 Z teacup Shortcut (IOI16_shortcut) C++14
컴파일 오류
0 ms 0 KB
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define ii pair<int,int>
#define vi vector<int>
typedef tuple<int,int,int> iii;
typedef tuple<int,int,int,int> iiii;
typedef vector<ii> vii; 

const int MAXN=255; int ans=1e15, curr;
vi AL[MAXN];
int pref[MAXN], suff[MAXN], sum[MAXN], S, E;
int find_shortcut(int32_t n, vi l, vi d, int32_t c){
    int temp=0;
    for (int i=1; i<=n; i++){
        pref[i] = max(pref[i-1],d[i-1]-temp);
        if (i<n) temp += l[i-1];
    }
    temp=0;
    for (int i=n; i>=1; i--){
        suff[i] = max(suff[i+1],d[i-1]-temp);
        if (i!=1) temp += l[i-2]; 
    }
    for (int i=0; i<n-1; i++){
        sum[i+2] = sum[i+1] + l[i];
    }
    
    for (int i=0; i<=n; i++){
        for (int j=i+1; j<=n; j++){
            curr=0;
            for (S=i; S<j; S++){
                for (E=S+1; E<=j; E++){
                    int ds = d[S-1], de=d[E-1];
                    if (S==i) ds = pref[S]+sum[S]-sum[1];
                    if (E==j) de = suff[E]+sum[n]-sum[E];
                    curr=max(curr,ds+de+min(sum[E]-sum[S],sum[j]-sum[i]-ds+c));
                }
            }
            for (S=i; S<=i; S++){
                for (E=S+1; E<=i; E++){
                    int ds = d[S-1], de=d[E-1];
                    curr=max(curr,ds+de+sum[E]-sum[S]);
                }
            }
            for (S=j; S<=i; S++){
                for (E=S+1; E<=i; E++){
                    int ds = d[S-1], de=d[E-1];
                    curr=max(curr,ds+de+sum[E]-sum[S]);
                }
            }
            ans = min(ans,curr);
        }
    }
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccGEvoY5.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