Submission #831767

#TimeUsernameProblemLanguageResultExecution timeMemory
831767waldiBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define FOR(i,p,k) for(int i=(p);i<=(k);++i) #define REP(i,n) FOR(i,0,(n)-1) typedef long long ll; using namespace std; ll delivery(int n, int k, int l, vector<int> poz){ ll wyn = ((ll)n)*((ll)l); FOR(off, 1, min(n, k)){ ll twyn = 0ll; for(int i = off-1; 1; i += k){ int poc = poz[max(i-k+1, 0)]; int kon = poz[min(i, n-1)]; if(kon <= l>>1) twyn += kon<<1; else if(poc >= (l+1)>>1) twyn += (l-poc)<<1; else twyn += l; if(i >= n-1) break; } wyn = min(wyn, twyn); } return wyn; } #ifdef LOCAL #define maxn 1000 int main(){ int n, k, l, p[maxn]; scanf("%d%d%d", &n, &k, &l); REP(i, n) scanf("%d", &p[i]); ll wyn = delivery(n, k, l, p); printf("%lld\n", wyn); } #endif

Compilation message (stderr)

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