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 teams[10000000];
long long delivery(int N, int K, int L, int p[]) {
long n = N, k = K, len = L;
long long ans = 1000000000000000000;
for (long i = 0; i < n; i++){
teams[i] = p[i];
}
for (long i = 0; i < k && i < n; i++){
long long t = min(len, min(2*teams[i], 2*(len-teams[0])));
long l = i+1, r = i+k;
while (true){
if (r >= n){
if (l < n){
r = n-1;
t += min(len, min(2*teams[r], 2*(len-teams[l])));
}
break;
}
t += min(len, min(2*teams[r], 2*(len-teams[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... |