Submission #185926

#TimeUsernameProblemLanguageResultExecution timeMemory
185926TAISA_Boxes with souvenirs (IOI15_boxes)C++14
0 / 100
15 ms376 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; using ll=long long; const ll LINF=(1LL<<60)-1LL; long long delivery(int N, int K, int L, int p[]) { ll res=LINF; if(N>1000){ return 0; } sort(p,p+N); int st=-1; for(int i=0;i<N;i++){ if(p[i]>0){ st=i; break; } } if(st==-1){ return 0; } vector<ll> sum(K); for(ll i=st;i<N;i++){ sum[(i-st)%K]+=2LL*p[i]; vector<ll> sum2(K); for(ll j=N-1;j>=i+1;j--){ sum2[(N-j-1)%K]+=2LL*(L-p[j]); res=min(res,sum[(i-st)%K]+sum2[(N-j-1)%K]+L*((j-i-1)/K+((j-i-1)%K>0))); } } return res; }
#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...