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;
using ll = long long;
#define MAXN (1000005)
long long delivery(int N, int K, int L, int p[]) {
ll minimum = 5e18;
ll clockwise[N];
ll total = 0;
for(ll i = 0;i < N;i++){
if(p[i] != 0) total++;
clockwise[i] = total / K;
if(total % K != 0) clockwise[i]++;
clockwise[i] *= (2 * p[i]);
}
ll anticlockwise[N];
total = 0;
for(ll i = N - 1;i >= 0;i--){
if(p[i] != 0) total++;
anticlockwise[i] = total / K;
if(total % K != 0) anticlockwise[i]++;
anticlockwise[i] *= (2 * (L - p[i]));
}
minimum = min(minimum,clockwise[N - 1]);
minimum = min(minimum,anticlockwise[0]);
for(ll i = 0;i < N - 1;i++){
minimum = min(minimum,clockwise[i] + anticlockwise[i + 1]);
}
return minimum;
}
# | 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... |