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<bits/stdc++.h>
//#include "boxes.h"
using namespace std;
typedef long long ll;
long long delivery(int N, int K, int L, int p[]) {
ll total=0;
int remaining=K;
for(int i=0;i<N;i++){
if(remaining==K)
total+=(ll)min(p[i],L-p[i]);
else
total+=(ll)min(p[i]-p[i-1],p[i-1]+(L-p[i]));
remaining--;
if(remaining==0 || i==N-1){
total+=(ll)min(p[i],L-p[i]);
remaining=K;
}
}
return total;
}
# | 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... |