Submission #601884

#TimeUsernameProblemLanguageResultExecution timeMemory
601884SummersBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms320 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; int a[1000000]; long long delivery(int N, int K, int L, int p[]) { int mid, i, ans=0; for(mid=0;mid<N;mid++) { if(p[mid]>L/2)break; } for(i=0;i<mid;i++) { a[i]=p[i]*2; if(i>=K)a[i]+=a[i-K]; } for(i=N-1;i>=mid;i--) { a[i]=(L-p[i])*2; if(N-i>K)a[i]+=a[i+K]; } ans=a[mid]+a[mid-1]; for(i=max((int)(0),mid-K);i<=min(N-1,mid);i++) { ans=min(ans, a[i]+a[i+K]+L); } return ans; }
#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...