Submission #705332

#TimeUsernameProblemLanguageResultExecution timeMemory
705332bin9638Boxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fs first #define sc second #define N 10000010 #define pb push_back ll sum_left[N],sum_right[N]; ll delivery(int n,int k,int l,ll a[]) { for(int i=1;i<=n;i++) if(i<=k) sum_left[i]=a[i-1]+min(a[i-1],l-a[i-1]); else sum_left[i]=sum_left[i-k]+1ll*a[i-1]+min(a[i-1],l-a[i-1]); for(int i=n;i>=1;i--) if(i+k-1>=n) sum_right[i]=l-a[i-1]+min(a[i-1],l-a[i-1]); else sum_right[i]=sum_right[i+k]+1ll*l-a[i-1]+min(a[i-1],l-a[i-1]); ll res=min(sum_left[n],sum_right[1]); for(int i=1;i<n;i++) res=min(res,sum_left[i]+sum_right[i+1]); return res; } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); // ios::sync_with_stdio(0); // cin.tie(NULL); // cout.tie(NULL); int n,k,l; cin>>n>>k>>l; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; cout<<delivery(n,k,l,a); return 0; } #endif // SKY

Compilation message (stderr)

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