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 <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "boxes.h"
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
long long ans = 1000000000000000000;
for (long i = 0; i < K && i < N; i++){
long long t = min(L, min(2*p[i], 2*(L-p[0])));
long l = i+1, r = i+K-1;
while (true){
if (r >= N){
if (l < N){
r = N-1;
t += min(L, min(2*p[r], 2*(L-p[l])));
}
break;
}
t += min(L, min(2*p[r], 2*(L-p[l])));
l += K;
r += K;
}
ans = min(ans, t);
}
return ans;
}
# | 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... |