Submission #666310

#TimeUsernameProblemLanguageResultExecution timeMemory
666310jamezzzBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms212 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define LINF 1023456789123456789 typedef long long ll; #define maxn 10000005 ll pfx[maxn], sfx[maxn]; ll delivery(int N,int K,int L,int p[]){ sort(p,p+N); ll cur=0; for(int i=N-1;i>=0;--i){ int cost=min(L,2*(L-p[i])); sfx[i]=cur+cost; if((N-i)%K==0)cur+=cost; } cur=0; ll ans=LINF; for(int i=0;i<N;++i){ int cost=min(L,2*p[i]); ans=min(ans,cur+cost+sfx[i+1]); if(i%K==K-1)cur+=cost; } 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...