Submission #389044

#TimeUsernameProblemLanguageResultExecution timeMemory
389044faresbasbsBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long n,k,l,num,in[10000001],dp1[10000001],dp2[10000001]; int main(){ cin >> n >> k >> l; num = l/2; long long ans = 1000000000000000000 , v1 = 0 , v2 = 0; for(long long i = 1 ; i <= n ; i += 1){ cin >> in[i]; if(in[i] <= num){ if(i >= k){ dp1[i] = dp1[i-k]; } dp1[i] += 2*in[i]; v1 = dp1[i]; } } for(long long i = n ; i >= 1 ; i -= 1){ if(in[i] <= num){ break; } if(i+k <= n){ dp2[i] = dp2[i+k]; } dp2[i] += 2*(l-in[i]); v2 = dp2[i]; } ans = v1+v2; if(k >= n){ ans = min(ans,l); } for(long long i = 1 ; i+k-1 <= n ; i += 1){ if(in[i] <= num && in[i+k-1] > num){ ans = min(ans,dp1[i-1]+l+dp2[i+k]); } } cout << ans << endl; }

Compilation message (stderr)

/tmp/cccxtXrK.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/cclkrFut.o:boxes.cpp:(.text.startup+0x0): first defined here
/tmp/cccxtXrK.o: In function `main':
grader.c:(.text.startup+0x1cb): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status