#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;
}
ll s=0;
for(ll i=st;i<N;i++){
ll t;
if((i-st+1)%K==0){
s+=2LL*p[i];
t=s;
}else{
t=s+2LL*p[i];
}
ll ss=0;
for(ll j=N-1;j>=i+1;j--){
ll tt;
if((N-j)%K==0){
ss+=2LL*(L-p[j]);
tt=ss;
}else{
tt=ss+2LL*(L-p[j]);
}
res=min(res,t+tt+L*((j-i-1)/K+((j-i-1)%K>0)));
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |