제출 #1197416

#제출 시각아이디문제언어결과실행 시간메모리
1197416pensive선물상자 (IOI15_boxes)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define REP(a,i,n) for (ll i=a;i<n;i++)

const int mx = 1e7;

ll pre[mx+1], suf[mx+1];
ll delivery(ll N, ll K, ll L, ll positions[]) {
    REP(0, i, N) {
        pre[i] = min(pre[i] + 2*positions[i], L);
        if (i>=K) {
            pre[i] += pre[i-K];
        }
    }
    ll ans = 1e11;
    for (int i=N-1;i>=0;i--) {
        suf[i] = min(suf[i] + 2*(L-positions[i]), L);
        if (i <= N-K-1) {
            suf[i] += suf[i+K];
        }
        ans = min(ans, ((i==0) ? 0 : pre[i-1])+suf[i]);
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccJazB4N.o: in function `main':
grader.c:(.text.startup+0x1ec): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status