Submission #390215

#TimeUsernameProblemLanguageResultExecution timeMemory
390215mariowongBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long n,m,l,a[10000005],dp[10000005]; deque <int> dq; int main(){ ios::sync_with_stdio(false); cin >> n >> m >> l; for (int i=1;i<=n;i++){ cin >> a[i]; } for (int i=1;i<=n;i++){ while (!dq.empty() && dq.front()+m <= i) dq.pop_front(); if (!dq.empty()) dp[i]=min(dp[max(0LL,i-m)]+a[i]*2,dp[dq.front()]+2*l-2*a[dq.front()+1]); else dp[i]=dp[max(0LL,i-m)]+a[i]*2; while (!dq.empty() && dp[dq.back()]-2*a[dq.back()+1] > dp[i]-2*a[i+1]) dq.pop_back(); dq.push_back(i); } cout << dp[n] << "\n"; return 0; }

Compilation message (stderr)

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