This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "boxes.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
//~ ll s1[10000100],s2[10000100];
long long delivery(int N, int K, int L, int p[]) {
ll Min=INF;
for(int i=0;i<=N;i++){
//[0,i) [i,N)
int cnt=0;
ll sum=0;
for(int j=i-1;j>=0;j--){
if(cnt==0)sum+=min(p[j],L-p[j]);
else sum+=p[j+1]-p[j];
cnt++;
if(cnt==K||j==0){
sum+=min(p[j],L-p[j]);
cnt=0;
}
}
for(int j=i;j<N;j++){
if(cnt==0)sum+=min(p[j],L-p[j]);
else sum+=p[j]-p[j-1];
cnt++;
if(cnt==K||j==N-1){
sum+=min(p[j],L-p[j]);
cnt=0;
}
}
Min=min(Min,sum);
}
return Min;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |