Submission #356528

#TimeUsernameProblemLanguageResultExecution timeMemory
356528leinad2Boxes with souvenirs (IOI15_boxes)C++17
0 / 100
3 ms364 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; long long i, n, k, l, ans=1e18, A[10000010], X[10000010], Y[10000010]; long long delivery(int N, int K, int L, int p[]) { n=N; k=K; l=L; for(i=0;i<n;i++)A[i]=p[i]; for(i=0;i<n;i++) { if(i>=k)X[i]=X[i-k]+2*A[i]; else X[i]=2*A[i]; } for(i=n-1;i>=0;i--) { if(i>n-1-k)Y[i]=2*(l-A[i]); else Y[i]=Y[i+k]+2*(l-A[i]); } for(i=0;i<n-1;i++) { ans=min(ans, X[i]+Y[i+1]); } 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...