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"
using namespace std;
#define ll long long
long long delivery(int n, int k, int l, int p[]) {
ll answer = LONG_MAX;
if (k == 1){//subtask1
for (int i = 0; i < n; i++)
answer += 2LL * min(p[i], l - p[i]);
}
else if(k == n){//subtask2
answer = l;
for (int i = 0; i + 1 < n; i++)
answer = min(answer, 2LL * (p[i] + l - p[i+1]));
}
return answer;
}
# | 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... |