Submission #416465

#TimeUsernameProblemLanguageResultExecution timeMemory
416465kevinxiehkBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include "boxes.h" #include "bits/stdc++.h" #define int long long #define iint int using namespace std; long long delivery(iint n, iint k, iint l, iint p[]) { int le[n + 5], lcnt = 0; int ri[n + 5], rcnt = 0; int ii = 0; while(ii < n && p[ii] <= l / 2) { le[lcnt] = p[ii]; lcnt++; ii++; } while(ii < n) { ri[rcnt] = l - p[ii]; rcnt++; ii++; } reverse(ri, ri + rcnt); int ll[lcnt + 5], rr[rcnt + 5]; ll[0] = 0, rr[0] = 0; for(int i = 1; i <= lcnt; i++) { ll[i] = (i <= k ? le[i - 1] * 2 : ll[i - k] + le[i - 1] * 2); } for(int i = 1; i <= rcnt; i++) { rr[i] = (i <= k ? ri[i - 1] * 2 : rr[i - k] + ri[i - 1] * 2); } int ans = ll[lcnt] + rr[rcnt]; for(int i = 0; i <= k; i++) { int lef = i; int rig = k - i; ans = min(ans, l + ll[max(0LL, lcnt - lef)] + rr[max(0LL, rcnt - rig)]); } return ans; }

Compilation message (stderr)

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