Submission #296366

#TimeUsernameProblemLanguageResultExecution timeMemory
296366TMJNBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
0 ms384 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long l[10000000]; long long r[10000000]; long long delivery(int N, int K, int L, int p[]) { long long mn; for(int i=0;i<K&&i<N;i++){ l[i]=p[i]; r[N-1-i]=L-p[N-1-i]; } for(int i=K;i<N;i++){ l[i]=l[i-K]+p[i]; r[N-1-i]=r[N-1-i+K]+L-p[N-1-i]; } mn=min(l[N-1],r[0]); for(int i=0;i<N-1;i++){ mn=min(mn,l[i]+r[i+1]); } if(K==N){ mn=min(mn,(long long)L); } mn=min(mn,L+r[min(K,N-1)]); for(int i=0;i<N;i++){ mn=min(mn,l[i]+L+r[min(i+K+1,N-1)]); } return mn; }
#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...