Submission #286759

#TimeUsernameProblemLanguageResultExecution timeMemory
286759MarlovBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms384 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,int position[]){ int ci=0; while(position[ci]==0){ ci++; N--; } int pos[N]; for(int i=ci;i<N+ci;i++){ pos[i-ci]=position[i]; //cout<<i-ci<<" with "<<pos[i-ci]<<'\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[i-K]; } /* for(int i=0;i<N;i++){ cout<<dpfront[i]<<" and "<<dpback[i]<<'\n'; } */ int result=min(dpback[N-1],dpfront[N-1]); for(int i=1;i<=N-1;i++){ result=min(dpfront[i-1]+dpback[N-i-1],result); } return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...