제출 #218469

#제출 시각아이디문제언어결과실행 시간메모리
218469socho선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include "bits/stdc++.h" using namespace std; #define int long long const int MXN = 10005; int n, k, l, h, pos[MXN], rpos[MXN]; int dpleft[MXN]; int dpright[MXN]; long long delivery(int N, int K, int L, int p[]) { for (int i=0; i<MXN; i++) { dpleft[i] = -1; dpright[i] = -1; } n = N; k = K; l = L; h = l/2; for (int i=0; i<n; i++) { pos[i] = p[i]; rpos[i] = L - p[i]; } int best = INT_MAX; for (int i=0; i<n; i++) { dpleft[i] = pos[i] * 2; if (i - k >= 0) dpleft[i] += dpleft[i-k]; } for (int i=n-1; i>=0; i--) { dpright[i] = rpos[i] * 2; if (i + k < n) dpright[i] += dpright[i+k]; } // for (int i=0; i<n; i++) cout << dpleft[i] << ' '; cout << endl; // for (int i=0; i<n; i++) cout << dpright[i] << ' '; cout << endl; for (int i=0; i<n-1; i++) { best = min(best, dpleft[i] + dpright[i+1]); } for (int i=0; i<n-1; i++) { int unt = l; if (i >= 1) unt += dpleft[i-1]; if (i + k < n) unt += dpright[i+k]; } return best; }

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

/tmp/ccgwqATU.o: In function `main':
grader.c:(.text.startup+0x22f): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status