Submission #286741

#TimeUsernameProblemLanguageResultExecution timeMemory
286741MarlovBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
/* Code by @marlov */ #include <iostream> #include <fstream> #include <string> #include <sstream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <iomanip> #include <utility> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <stack> #include <queue> #include <iterator> using namespace std; typedef long long ll; typedef pair<int,int> pi; #define maxN 10000000 int dpfront[maxN],dpback[maxN]; int delivery(int N,int K,int L,vector<int> pos){ while(pos.front()==0){ pos.erase(pos.begin()); N--; } for(int i=0;i<N;i++){ if(i<K) dpfront[i]=min(L,2*pos[i]); else dpfront[i]=min(L,2*pos[i])+dpfront[i-K]; } for(int i=0;i<N;i++){ if(i<K) dpback[i]=min(L,2*(L-pos[N-i-1])); else dpback[i]=min(L,2*(L-pos[N-i-1]))+dpback[N-i-1+K]; } int result=min(dpback[N],dpfront[N]); for(int i=1;i<N-1;i++){ result=max(dpfront[i]+dpback[N-i-1],result); } return result; } /* stuff you should look for * int overflow, array bounds * special cases (n=1,n=0?) * do smth instead of nothing and stay organized */

Compilation message (stderr)

/tmp/ccuqnGlG.o: In function `main':
grader.c:(.text.startup+0x1b4): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status