Submission #947609

#TimeUsernameProblemLanguageResultExecution timeMemory
9476094QT0RBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll pref[10000002]; ll suf[10000002]; ll delivery(ll n, ll k, ll l, ll positions[]){ for (ll i = 0; i<k; i++)pref[i]=positions[i]; for (ll i = k; i<n; i++)pref[i]=positions[i]+pref[i-k]; for (ll i = n-1; i>n-k-1; i--)suf[i]=l-positions[i]; for (ll i = n-k-1; i>=0; i--)suf[i]=l-positions[i]+suf[i+k]; ll ans=suf[0]; for (ll i = 0; i<n-1; i++)ans=min(ans,2*pref[i]+2*suf[i+1]); for (ll i = 0; i<n-1; i++)ans=min(ans,2*pref[i]+l+2*(i+k<n ? suf[i+k] : suf[n-1])); return ans; }

Compilation message (stderr)

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